develooper Front page | perl.perl5.porters | Postings from November 2013

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

Thread Previous | Thread Next
From:
Craig A. Berry
Date:
November 20, 2013 15:04
Subject:
Re: Option to use and create "unique" library names
Message ID:
CA+vYcVyi7ze5jh7a7GjMC+nvPP=uH+zECXW5-Br9Cy2X1WiKXw@mail.gmail.com
On Tue, Nov 19, 2013 at 11:41 PM, Brian Fraser <fraserbn@gmail.com> 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 Util.so, 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/Util.so becomes Hash/Util/Perl_Hash_Util.so.

We've done this since forever on VMS; the actual shareable image
(dynamic library) names come out as PL_HASH__UTIL.EXE and
PL_LIST__UTIL.EXE.  There is a function called DynaLoader::mod2fname
that gets called from XSLoader::load.  Here's what it does:

$ perl -MDynaLoader -e "@a=('Module','SubModule','SubSubModule');
print DynaLoader::mod2fname(\@a);"
PL_Module__SubModule__SubSubModule

So I think you can get what you want by simply implementing a
mod2fname function (ours is in vms/vms.c, but dl_xxx.xs might be a
better place for a new one).  And I think there's a good chance you
wouldn't need any MakeMaker modifications as mod2fname, if it exists,
is already called from MM_Unix::init_main().

Plus it seems less than optimal to introduce an entirely new mechanism
to do something for which there is already an existing mechanism.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About