This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Shall dlopen("foo") succeeed if only "foo.dll" exists?


Corinna Vinschen wrote:

> But what about perl?  It uses the .dll suffix for modules on Cygwin.

perl uses dl_dlopen.xs on cygwin AFAICT, which basically passes its
arguments unchanged to the system dlopen.

> Does it call dlopen("foo.dll") or dlopen("foo")?

Looking at DynaLoader_pm.PL (this is self-modifying code, used to
generate the actual DynaLoader.pm, so it's a little odd):

($dl_dlext, $dl_so, $dlsrc) = @Config::Config{qw(dlext so dlsrc)};

sub dl_findfile {
...
   #  Only files should get this far...
   my(@names, $name);    # what filenames to look for
   if (m:-l: ) {          # convert -lname to appropriate library name
     s/-l//;
     push(@names,"lib$_.$dl_so");
     push(@names,"lib$_.a");
   } else {                # Umm, a bare name. Try various alternatives:
     # these should be ordered with the most likely first
     push(@names,"$_.$dl_dlext")    unless m/\.$dl_dlext$/o;
     push(@names,"$_.$dl_so")     unless m/\.$dl_so$/o;
     push(@names,"lib$_.$dl_so")  unless m:/:;
     push(@names,"$_.a")          if !m/\.a$/ and $dlsrc eq "dl_dld.xs";
     push(@names, $_);
   }
...

On cygwin:
use Config; print join("\n",@Config::Config{qw(dlext so dlsrc)});
dll
dll
dl_dlopen.xs

So it looks like perl itself accepts either a "bare" library name, or a
properly .dll-decorated one (or even "-lfoo"!) -- but will eventually
try the .dll extension if "bare" fails.

--
Chuck

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]