C++ Logo

std-discussion

Advanced search

Re: Global array of objects over multiple files

From: Federico Kircheis <federico_at_[hidden]>
Date: Sat, 19 Oct 2024 17:25:03 +0000
On 19 October 2024 17:10:53 UTC, Thiago Macieira via Std-Discussion <std-discussion_at_[hidden]> wrote:
>On Saturday 19 October 2024 09:56:11 GMT-7 Federico Kircheis via Std-
>Discussion wrote:
>> Dynamic kinking already breaks multiple guarantees from the standard; for
>> example that function pointers are always valid, and many things that have
>> to do with global objects, I personally do not see why this array should be
>> treated differently
>
>None of that is true for simple C++ code. In order for any of it to happen,
>you must have used some non-standard feature, such as an __attribute__.
>

Or dlopen, loadlibrary,... Which are just functions; outside of the standard, like the rest of dynamic linking

No need for attributes, assembly, or other compiler extensions, or strange constructs.
Global variables are problematic in shared libraries, that's it.

Received on 2024-10-19 17:25:13