delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/10/03/09:54:46

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Wed, 4 Oct 2000 00:52:13 +1100
From: Fergus Henderson <fjh AT cs DOT mu DOT oz DOT au>
To: "Gary V. Vaughan" <gvv AT techie DOT com>, cygwin AT sources DOT redhat DOT com,
cgf AT cygnus DOT com
Subject: Re: linking against shared libraries
Message-ID: <20001004005212.A9274@murlibobo.cs.mu.OZ.AU>
References: <012a01c02033$936effc0$f7c723cb AT lifelesswks> <20000917010735 DOT G606 AT demon DOT co DOT uk> <20000916234420 DOT A23827 AT cygnus DOT com> <20000917122440 DOT I606 AT demon DOT co DOT uk> <20000917122837 DOT A24997 AT cygnus DOT com>
Mime-Version: 1.0
X-Mailer: Mutt 0.95.1i
In-Reply-To: <20000917122837.A24997@cygnus.com>; from Chris Faylor on Sun, Sep 17, 2000 at 12:28:37PM -0400

On 17-Sep-2000, Chris Faylor <cgf AT cygnus DOT com> wrote:
> On Sun, Sep 17, 2000 at 12:24:40PM +0100, Gary V. Vaughan wrote:
> >If you are interested, I will add an entry to my TODO list to see if I
> >can take some of the nicities from the libtldl LoadLibrary wrapper
> >code and apply them to the Cygwin LoadLibrary wrapper?  (Automatic `_'
> >prefixing for example).
> 
> Is this a characteristic of normal linux/UNIX dlsym?

AFAIK, Unix systems that support dlopen() don't prefix C symbol
names with `_' when compiling them to assembler in the first place,
so the issue is moot.  At least this is the case on Solaris (2.7),
Linux (>= libc6), and OSF1 (3.2 ), which are the systems that
I have easily available right now.  dlopen() originated on Solaris,
according to the Linux man page.

On systems such as Cygwin which do prefix C names with `_' when
compiling to assembler, whether dlopen() should prefix the name with an
underscore depends on whether the name that the user is trying to look
up is an assembly name or a C name.  If it's a C name, then it's right
for dlopen() to prefix the name with an underscore, to match what the
C compiler does, but if it's an assembly name, then doing that would
be wrong.  Unfortunately the interface to dlopen() provides the
dlopen() implementation with no clues as to which one the user meant.
The documentation for dlopen() says that the argument is the "symbol
name", which is ambiguous, but could be read as implying that it is
supposed to be the assembly name.  However, in practice most uses of
dlopen() tend to be passing C names rather than assembler names.

Probably most uses of dlopen() are for C names, and so inserting
the prefix would work well in most cases.  However, inserting the
prefix would also make it impossible to look up assember names that
don't start with underscore using dlopen().

It's a bit like the issue of text-versus-binary:
the original unix-only interface didn't need to distinguish
between the different cases (text/binary or C/asm/whatever),
but in the Windows environment, you do need to make such
distinctions.  So some programs will need source modifications.
The best you can do is to choose the default carefully,
and make it easy to override the default for programs for which
the default is not appropriate.

-- 
Fergus Henderson <fjh AT cs DOT mu DOT oz DOT au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh AT 128 DOT 250 DOT 37 DOT 3        |     -- the last words of T. S. Garp.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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