delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/01/06/19:43:00

From: bji AT pobox DOT com ("Bryan J. Ischo")
Subject: Building Relocateable DLLs
6 Jan 1997 19:43:00 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199701070109.RAA00853.cygnus.gnu-win32@gleb.connectinc.com>
Reply-To: bji AT pobox DOT com
Original-To: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Hi.  I am very new to this list and to Win32 programming and I have a
question which unfortunately may have been answered before.

At the Cygnus web site, there is a page which describes the steps to
build a DLL out of two functions from two .c files, and then how to
build an executable with dependencies on that DLL via an intermediary
..a file.

In step 4 of this process, ld is run to build the DLL as follows:

ld -o foo.dll foo.exp foo.o foo2.o

Later, it is explained that the dll which is built here is
"non-relocatable". So I did a little tinkering to see if a relocatable
DLL could be built.  I noticed that ld has an option (-i, -r, or
--relocateable) to specify "location-independent output".  I used it
as follows:

ld --relocateable -o foo.dll foo.exp foo.o foo2.o

and it seemed to work.  But later when I ran the test program, Windows
NT popped up a dialog stating that the DLL was not in the proper
format.

So obviously there is more to building a relocatable DLL than just
specifying --relocateable to ld.  Does anyone have any idea what else
needs to be done?

Also, any pointers to documentation not mentioned in the Cygnus web
pages would be appreciated.  It seems that cygnus-win32 documentation
is scarce.

A big thanks to Cygnus for the work that has gone into porting the GNU
tools (which are, after all, the best development tools in existence) to
Win32.  If it weren't for their efforts, I wouldn't even be bothering to
try porting my code to NT.

Thanks very much,
Bryan

-- 
------------------------------------------------------------------------
Bryan Ischo                                         mailto:bji AT pobox DOT com
Mountain View, CA, USA                         http://www.pobox.com/~bji
Linux Aficionado                                         1990 Honda CB-1
-
For help on using this list, 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