delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/04/22:40:01

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4AF248D2.7090208@cwilson.fastmail.fm>
Date: Wed, 04 Nov 2009 22:38:58 -0500
From: Charles Wilson <cygwin AT cwilson DOT fastmail DOT fm>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Shall dlopen("foo") succeeed if only "foo.dll" exists?
References: <20091102164807 DOT GA2897 AT calimero DOT vinschen DOT de> <4AEF9E10 DOT 6030804 AT byu DOT net> <20091103100045 DOT GA18643 AT calimero DOT vinschen DOT de> <4AF0D545 DOT 7060407 AT cwilson DOT fastmail DOT fm> <20091104092938 DOT GB31924 AT calimero DOT vinschen DOT de>
In-Reply-To: <20091104092938.GB31924@calimero.vinschen.de>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019