Subject: DLLs and global data: how?
From: [email-masked] (MCL)

9 May 1998 03:18:50 -0700
Message-ID: <[email-masked]>
Reply-To: [email-masked]
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=US-ASCII
To: [email-masked]

    Hello.  First of all, congratulations to all the people who made
and contributed to GNU-Win32 --- definitely an outstanding product.

    Now, to the point: I am porting a Unix application, and I am
having troubles with dynamic linking.  I use to call the dlopen()
family of calls to load .so files and to call the code inside.

    I managed (using Fergus Henderson's Makefile.DLLs, thanks Fergus)
to produce a non-relocatable .DLL which I can directly load, access
function addresses, call them, and get a valid return code.  Problems
start now:

    * If the function returns, e.g., a pointer to a non-stack variable
defined in the .DLL (say, a string), the returned value does not seem
to be valid in the scope of the calling process --- at least, it does
not point to the string.  Trying to get the address of the string with
dlsym() yields a different value, which does not seem to be right,
either.  The string variable is exported in the .def file.

    * I found no way to let the .DLL call functions defined in the
main process --- and I can't use dlsym() to get their addresses.

    I suppose there is a kind of wizardry I am skipping --- I know
basically nothing about Windows NT dynamic linking process. 

    Should I build a relocatable .DLL?  I tried (not too hard) and I
failed.  Should I make something special to the addressess of the
objects in the DLL?  How could I avoid the "undefined reference to
XXX" --- I know it is not defined there, but in the main application
code?  I have searched through the mailing lists archive, but I did
not find any answer (or I could not recognize it).

    BTW, I am using Cygnus Beta 19.1. 

    Thanks for any help,

        Manuel

______________________________________
Oh, no, those damned melodies again...
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".