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]

linking against shared libraries


Gary thanks for your tips on libtool... I have it _mostly_ working. There
are two issues I've found during my work on glib. (BTW the long delay is
becuase this is a 'spare time project'

1. Linking against installed shared libraries without libtool fails however.

ld finds the .a file, not the .dll file.

example: using testglib.c from the glib 1.2.8 tarball.

gcc testglib.c -o
testglib.exe -I/usr/local/include -I/use/local/lib/g;lib/include -lglib

usr/local/lib is in my ld run path.. GCC correctly finds the library
functions., and looks for the _imp_ prefix in front of exported variables
(as per the .h file) but can't find the exported variables.
ld fails to find 0lglib if libglib.a is renamed, but libglib.la and
libglib-1-2-0-0-8.dll are present.

running libtool gcc testglib.c -o
testglib.exe -I/usr/local/include -I/use/local/lib/g;lib/include
/usr/local/lib/libglib.la
causes
gcc testglib.c -o testglib.exe -I/usr/local/include -I
/usr/local/lib/glib/include
/usr/local/lib/libglib-1-2-0-0-8.dll -Wl,--rpath -Wl,/usr/local/lib -Wl,--rp
ath -Wl,/usr/local/lib
To be run, which works correctly.

Running the first command, replacing -lglib with
/usr/local/lib/libglib-1-2-0-0-8.dll works.
Equally renaming the -1-2-0-0-8.dll to libglib.dll works.

I suspect this is either a libtool dll naming issue or a ld search order
issue. Unfortunately I don't have the spare time to dig into it.

2. I'm having problems with dlsym/dlopen et al.

Can anyone point me to some references on using dlsym/dlopen under cygwin
with libtool generated dll's?
    Ok so maybe a reference guide is a bit hopeful.
I'm happy to keep reading the various disparate bits of doco floating around
but narrowing the search would help.

Specifically are there any quirks with dlopen/dlsym on cygwin (other than
the library being a .dll not a .so?)

The call that is stumping me at the moment is dlsym (handle to self,
"g_module_close"). nm shows a _g_module_close and a _imp__g_module_close in
the test .exe
The purpose is to retrieve the symbol address, of a dynamically bound
function...


FWIW I'm working on getting libgmodule working, I've successfully built the
whole gnome-base and core-apps tarballs. (without dynamic libraries... and
thus libgmodule is needed) Once gmodule is working there should be full
(-sound) gnome capabilities for an NT based system (with Cygwin/XFree86).




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