delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/05/09/03:18:50

From: boris AT pizarro DOT dia DOT fi DOT upm DOT es (MCL)
Subject: DLLs and global data: how?
9 May 1998 03:18:50 -0700 :
Message-ID: <199805081734.TAA04110.cygnus.gnu-win32@pizarro.dia.fi.upm.es>
Reply-To: boris AT clip DOT dia DOT fi DOT upm DOT es
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com

    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
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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