Imake and DLLs under Cygwin
Suhaib Siddiqi
ssiddiqi@ipass.net
Wed Aug 18 10:09:00 GMT 1999
First
you need to figure out the export symbols from your code and
write
service-def.cpp.
ÃÂ
You
can grab the updates cygwin.cf, cygwin.rules and cygwin.tmpl, plus
Imake.cf
from
cygwin-xfree source tree.ÃÂ It is at
sourceware.cygnus.com/pub/cygwin/xfree
and
would be more helpfull if you direct the further questions from that source tree
to
cygwin-xfree mailing list.
ÃÂ
Suhaib
ÃÂ
-----Original Message----- From:
cygwin-owner@sourceware.cygnus.com
[mailto:cygwin-owner@sourceware.cygnus.com] On Behalf Of
Richard Sent: Wednesday, August 18, 1999 12:50 PM To:
cygwin@sourceware.cygnus.com Subject: Imake and DLLs under
Cygwin I have an application which I've successfully
rebuilt on Solaris.ÃÂ It was configured with imake. I now have a
requirement to port it to Cygwin.ÃÂ Using the imake from my X11
distribution there have been various errors due to the Cygwin configuration
files (cygwin.tmpl, cygwin.rules ... in X11R6.4/lib/X11/config) being somewhat
out-of-date, but these have been solved.
The problem comes with the attempt to produce a 'shared library' (DLL on
Cygwin of course).ÃÂ The Imakefile uses the imake rule
SharedLibraryTarget(...): --------------------------- #define
SharedLibraryTarget(libname,rev,solist,down,up)ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
@@\
AllTarget(Concat3(lib,libname,.dll))ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ
@@\ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ @@\
CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES))
@@\ ---------------------------
which produces the following make rules:
--------------------------- service.def::ÃÂ service-def.cpp
$(ICONFIGFILES) ÃÂ $(RM) $@ ÃÂ $(CPP)ÃÂ
-DLIBRARY_VERSION=1 <service-def.cpp | sed -e '/^#ÃÂ *[0-9][0-9]*ÃÂ
*.*$$/d' -e\ '/^XCOMM$$/s//#/' -e '/^XCOMM[^a-zA-Z0-9_]/s/^XCOMM/#/'
>$@
clean:: ÃÂ $(RM) service.def
junk.c: ÃÂ echo "#include
<cygwin/cygwin_dll.h>"ÃÂ >junk.c ÃÂ echo
"DECLARE_CYGWIN_DLL(dll_main);"ÃÂ >>junk.c ÃÂ echo
"int WINAPI dll_main(HANDLE a, DWORD reason, void *q)" >>junk.c
ÃÂ echo "{ return 1; }"ÃÂ ÃÂ ÃÂ >>junk.c
libservice.dll: $(OBJS) junk.o service.def ÃÂ $(RM)
libservice.a ÃÂ $(RM) libservice.dll
ÃÂ if [ -f $(BASE_COUNTER) ]; then true; \ ÃÂ else
echo 0x67000000 > $(BASE_COUNTER); fi ÃÂ dllwrap -s --def
service.def --output-lib libservice.a -o libservice.dll $(OBJS) junk.o
$(REQUIREDLIBS) -image-base `cat $(BASE_COUNTER)`
ÃÂ IMAGE_LENGTH=`objdump -x libservice.dll |awk '/SizeOfImage/
{print "0x"$$2}'`; \ ÃÂ export IMAGE_LENGTH=`expr '(' \`printf
%u $$IMAGE_LENGTH\` / 65536 + 1 ')' '*' 65536` ; \ ÃÂ export
IMAGE_BASE=`cat $(BASE_COUNTER)`; \ ÃÂ printf 0x%x `expr
\`printf %u $$IMAGE_BASE\` + $$IMAGE_LENGTH` > $(BASE_COUNTER)
ÃÂ $(_NULLCMD_) ----------------------------
The problem is that I don't have any service-def.cpp, and I don't know the
correct format for it.
When I write my own 'service.def' and exclude the 'service.def' rule from
the makefile, it fails with: dlltool: unrecognized option
`--exclude-symbol=_cygwin_dll_entry@12'
My dllwrap is version 0.2.4 and dlltool 2.9.4.
When I copy the 'dllwrap' line to the command line it runs without error
(surprisingly), but the nm says 'No symbols in "libservice.dll"'.
Has anyone been though this sort of thing before?
More information about the Cygwin
mailing list