This is the mail archive of the cygwin@sources.redhat.com 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]

Re: linking against shared libraries


On 17-Sep-2000, Chris Faylor <cgf@cygnus.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@cs.mu.oz.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@128.250.37.3        |     -- the last words of T. S. Garp.

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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