Adriaan van Os wrote:
Waldek Hebisch wrote:
Adriaan van Os wrote:
Waldek Hebisch wrote:
Adriaan van Os wrote:
Waldek Hebisch wrote:
However, if you use multiple shared libraries and static libgpc, then each shared library will bring its own copy of libgpc. In particular there will be two copies of libgpc data. Depending on dynamic linker you will get dynamic link errors or subtle errors at runtime.
Unless global symbols from libgpc are marked as non-global in the shared library, e.g.
That is the case of subtle errors: consider things like signal handlers or file buffers. You do not want handler from library A to clean up only library A when library B caused an error. You do not want to have two file buffers for a single file. While I have _not_ checked that any of the above may happen in gpc runtime, just by Murphy something will get broken.
I see the point, but what is the difference between this situation (two shared libraries, each with a copy of libgpc) and e.g. one library written in Pascal and the other in a language xxx ?
_p__rts_Init_init(); mylib_init();
Is it better to call _p__rts_Init_init rather than _p_initialize ? Does everything get initialized correctly then ?
What is better depends on goals. AFAICS if we only do the above then arguments and environment effectively will be empty. If a a Pascal main program dynamically loads the library, then call to _p_initialize will wipe out main program environment and arguments (IIUC normally dynamic linker loads libraries _before_ the main program, but it is possible to load libraries _after_ the main program has started).