X-Recipient: archive-cygwin@delorie.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@cwilson.fastmail.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@cygwin.com
Subject: Re: Shall dlopen("foo") succeeed if only "foo.dll" exists?
References: <20091102164807.GA2897@calimero.vinschen.de>  <4AEF9E10.6030804@byu.net>  <20091103100045.GA18643@calimero.vinschen.de>  <4AF0D545.7060407@cwilson.fastmail.fm> <20091104092938.GB31924@calimero.vinschen.de>
In-Reply-To: <20091104092938.GB31924@calimero.vinschen.de>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.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

