lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Am 24.11.18 um 03:36 schröbte Sean Conner:
It was thus said that the Great Philipp Janda once stated:
Am 23.11.18 um 06:47 schröbte Sean Conner:

[...]

	5.1.1.2:

	8 All external object and function references are resolved.  Library
	  components are linked to satisfy external references to functions
	  and objects not defined in the current translation.  All such
	  translator output is collected into a program image which contains
	  information needed for execution in its execution environment.

   I interpret this to mean, "if the given object files do not include an
object or function with external linkage, then said objects or functions
can be pulled from a "library".

Which library if there were multiple ones containing the same external
definition?

   I don't think that's covered in the C Standard.

Well, the C standard does (un-)define it for an entire program (the set of translation units and libraries). You are the one who wants to have certain parts of those libraries excluded from the entire program based on a linking order.

I know that the C tool
chains I've used over the years have all defaulted to "seach each library,
in order specified on the command line" which seems a reasonable thing to
do.

This order is actually required by POSIX[88], so most UNIX compilers will behave this way. One exception is apparently clang[89]. But, AFAICS, unfortunately even POSIX does not define whether multiple definitions are allowed or not.


[...]
>    -spc

Philipp


[88]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/c99.html#tag_20_11_04
  [89]:  https://lld.llvm.org/NewLLD.html#key-concepts