Thanks: Solved: DLLs
Alexander Mader
mader@niles.de
Tue Jul 6 08:14:00 GMT 1999
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@kapp-coburg.de>
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com
More information about the Cygwin
mailing list