delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/07/06/11:16:18

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <37821CB3.96092D2C@niles.de>
Date: Tue, 06 Jul 1999 17:11:47 +0200
From: Alexander Mader <mader AT niles DOT de>
Organization: KAPP GmbH & Co KG
X-Mailer: Mozilla 4.04 [en] (WinNT; I)
MIME-Version: 1.0
To: Pontus Lidman <pontus AT mathcore DOT com>
CC: cygwin AT sourceware DOT cygnus DOT com, klaus AT niles DOT de
Subject: Thanks: Solved: DLLs
References: <Pine DOT LNX DOT 3 DOT 96 DOT 990621131852 DOT 21184A-100000 AT mercury DOT xraylith DOT wisc DOT edu>

Hallo,

some days ago Pontus Lidman answered an email regarding
DLLs. Following the hints given in this answer and elsewhere in the
thread "variation on the .dll, .lib, .a theme (help!)" I was able to
solve the following problem:

	Given an MS built application build a DLL loadable by this
	application using GNU tools.
	In this DLL call functions provided by the original
	application in a DLL built using MS tools.

In other words the task was to build a DLL with a MS entry point, the
suitable calling convention, and resolved symbols from the
application's MS DLL.

Following Pontus' hint I declared my funtions for export as
__declspec(dllexport). This was not neccessary in MSVC -- something
somewhere must be fixing this. So the declaration reads something like

	  extern __declspec(dllexport)
	  foo( < params > )
	  { 
	    < body >
	  }

Following the hints of Takayuki Tamura I prepared the application's MS
DLLs to be linkable for my purposes. I produced an export definitions
file from the according .lib and used this with dlltool to get a .a
library. So for a pair MSNAME.LIB, MSNAME.DLL I had something like

	 echo "EXPORTS" > msname.def
	 nm --demangle --defined-only MSNAME.lib 
	 |sed -n 's/^.* T //p' >> .def
	 dlltool --dllname MSNAME.DLL --def msname.def \
	 --output-lib libmsname.a

Now I could take the Makefile.nocyg from the example "How to make JNI
..." provided by Mumit Khan at 
http://www.xraylith.wisc.edu/~khan/software/gnu-win32/
added the appropiate -L<mylibdir> and -lmsname and got a working DLL.

Thank you very much.

Alexander.
-- 
Alexander Mader <mader AT kapp-coburg DOT de>

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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