dlmopen on MacOS

Adriaan van Os via fpc-pascal <[email protected]>
Newsgroups gmane.comp.compilers.free-pascal.general
Message-ID <[email protected]>
I have a shared library on MacOS written in FPC. It needs to be loaded multiple times, that is each 
time with its own set of global (dylib) variables. On Linux I would use dlmopen with LM_ID_NEWLM, 
but MacOS doesn't have dlmopen and dlopen doesn't have LM_ID_NEWLM. I can create a copy of the 
dylib on the fly and load the copy. But then the OS will complain about ObjC/ObjPascal namespace 
collisions, even when loading with RTLD_LOCAL.

One wonders how operating systems can be designed that brainlessly.

Of course, I could write my own Mach-O loader, but I have other things to do.

Another idea is to prevent all use of global variables in the dylib. Before I do that, my question 
is if implicit compiler global variables (for the dylib code, not for the FPC runtime lib) would 
spoil that idea ?

Regards,

Adriaan van Os



_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.