delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/03/20:14:30

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: <4AF0D545.7060407@cwilson.fastmail.fm>
Date: Tue, 03 Nov 2009 20:13:41 -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>
In-Reply-To: <20091103100045.GA18643@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:
> On Nov  2 20:05, Eric Blake wrote:
>> According to Corinna Vinschen on 11/2/2009 9:48 AM:
>>> While we tend to change the implementation to be more Linux-like,
>>> there could be some tools out there which erroneously depend on the
>>> Windows-like behaviour of Cygwin's dlopen().
>> My only worry is whether libtool depends on this behavior.  But a quick
>> look at the source code (although not a definitive one) shows that libtool
>> is already adding a trailing dot on its own, in order to bypass window's
>> automatic .dll appending.  So if anything, I'm guessing that not adding an
>> implicit suffix is actually what libtool would prefer.

Not exactly.  That behavior only occurs in the loadlibrary.c file, which
is the native win32 libltdl implementation.  cygwin uses the dlopen.c
implemention (first), and then falls back on the loadlibrary one only if
dlopen method fails.

But the main point is this: in *most* cases, the name of the module to
be opened is expected to include the suffix (which might actually be ".la").

If there is a libltdl client out there that is written as
lt_dlopen("libfoo") and expects to get "libfoo.dll" -- it won't really
work cross platform, because the unix/dlopen wrapper is not going to
magically find "libfoo.so".

> Maybe Chuck can make this definitive?

But that's not to say there aren't some packages out there that do
something evil like this:

#if defined(__HPUX__)
# define MODULE_EXTENSION ".sl"
#elif !defined(__CYGWIN__) && !defined(_WIN32)
# define MODULE_EXTENSION ".so"
#else
# define MODULE_EXTENSION ""
#endif
#define MODULE "libfoo" MODULE_EXTENSION

But, IMO, they should Not. Do. That. and deserve whatever pain they get.

--
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