lua-users home
lua-l archive

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


If you use non-shared libraries, in fact the result is unpredictable, you could as well have seen:

Hello from main
        Hello from func1
        Hello from func2
        Back to func1
Back to main
        Hello from func2
Back to main

That's what I was demonstrating: there's undefined behavior ONLY if you use non-shared libraries because the order of units in these libraries is NOT significant.
And in fact makes the use of "pre-linked" even more relevant to this discussion.

Only non-shared libraries are not portable if you have multiple units defining the same symbol.
But you are not required to use them if, instead, you use a linker directly and specify a full list of units names (or shared library names) where the order of resolution is entirely determined.