develooper Front page | perl.perl5.porters | Postings from January 2014

Re: Option to use and create "unique" library names

Thread Previous | Thread Next
January 7, 2014 06:53
Re: Option to use and create "unique" library names
Message ID:
Brian Fraser wrote:
> Background:
> Android's linker has some bugg^Wunusual behavior, in that it caches loaded
> libraries, but only uses the basename in the cache.  That means that,
> as far as its dlopen() is concerned, the libraries for Hash::Util and 
> List::Util,
> both of which are named, are the same.
> What we did in the android branch was introduce an option, d_libname_unique,
> that when defined, has Makemaker create an "unique" libname for each module,
> and teaches XSLoader and Dynaloader to look for those; So for example,
> Hash/Util/ becomes Hash/Util/
> The changes for this are in 
> and can be tested by compiling perl with -Dd_libname_unique.
> Any objections to this going in?

I'm wondering a little bit if Win32 Perl needs this. Win32's runtime 
linker does the same basename matching unless you pass an absolute path 
(Dynaloader passes absolute paths to Win32's runtime linker). A big 
problem results, if a XS DLL has the same filename as non-XS DLL, and 
another DLL tries to link to the filename, and linker finds the XS DLL 
instead, which only exports the boot function, not dozens of non-Perl C 
functions. Here is one with version::'s version.dll conflicting with 
MS's version.dll (MS version.dll is a metadata library for PE files's 
"version resource") . I also 
recently ran into this problem with building 
which generated a GMP.dll, which linked to gmp.dll, and couldn't be 
loaded into any process due to missing functions (GMP.dll the XS lib's 
imported functions were attempted to be resolved with GMP.dll the XS 
lib's exported function table by the Win32 runtime linker, instead of 
searching for another gmp.dll using the default collection of folders). 
I had to rename the C function exporting gmp.dll to something else and 
recompile to make it work.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About