Quantcast
Channel: The Old New Thing
Viewing all articles
Browse latest Browse all 24428

re: Understanding the classical model for linking, groundwork: The algorithm

$
0
0

Another non-classical behavior: weak symbols vs. strong symbols.  Symbols are strong by default and can be marked as weak with the __attribute__((weak)) syntax in GCC and GCC-like compilers (I'm unsure if any of the Microsoft compilers support a similar feature).

If the symbol is already in the module marked as resolved:

- If both the original symbol and the new symbol are marked __attribute__((weak)), then do not raise an error.  Pick one arbitrarily and discard the other.

- If one of the original symbol and the new symbol is marked __attribute__((weak)), then do not raise an error.  Pick the strong symbol and discard the weak symbol.

- Otherwise, raise an error complaining that an object has multiple definitions.


Viewing all articles
Browse latest Browse all 24428

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>