delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/08/18/12:50:17

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>,
<http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <37BAE433.C330099C@mcd.alcatel.be>
Date: Wed, 18 Aug 1999 18:49:55 +0200
From: Richard <hicklinr AT mcd DOT alcatel DOT be>
X-Mailer: Mozilla 4.61 [en] (WinNT; I)
X-Accept-Language: en
MIME-Version: 1.0
To: "cygwin AT sourceware DOT cygnus DOT com" <cygwin AT sourceware DOT cygnus DOT com>
Subject: Imake and DLLs under Cygwin

--------------214511E6729F99BAED54F939
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

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 AT 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?

--------------214511E6729F99BAED54F939
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I have an application which I've successfully rebuilt on Solaris.&nbsp;
It was configured with imake.
<br>I now have a requirement to port it to Cygwin.&nbsp; 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.
<p>The problem comes with the attempt to produce a 'shared library' (DLL
on Cygwin of course).&nbsp; The Imakefile uses the imake rule SharedLibraryTarget(...):
<br>---------------------------
<br><tt>#define SharedLibraryTarget(libname,rev,solist,down,up)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@@\</tt>
<br><tt>AllTarget(Concat3(lib,libname,.dll))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@@\</tt>
<br><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @@\</tt>
<br><tt>CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=rev,$(ICONFIGFILES))
@@\</tt>
<br>---------------------------
<p>which produces the following make rules:
<p>---------------------------
<br><tt>service.def::&nbsp; service-def.cpp $(ICONFIGFILES)</tt>
<br><tt>&nbsp;$(RM) $@</tt>
<br><tt>&nbsp;$(CPP)&nbsp; -DLIBRARY_VERSION=1 &lt;service-def.cpp | sed
-e '/^#&nbsp; *[0-9][0-9]*&nbsp; *.*$$/d' -e\ '/^XCOMM$$/s//#/' -e '/^XCOMM[^a-zA-Z0-9_]/s/^XCOMM/#/'
>$@</tt>
<p><tt>clean::</tt>
<br><tt>&nbsp;$(RM) service.def</tt>
<p><tt>junk.c:</tt>
<br><tt>&nbsp;echo "#include &lt;cygwin/cygwin_dll.h>"&nbsp; >junk.c</tt>
<br><tt>&nbsp;echo "DECLARE_CYGWIN_DLL(dll_main);"&nbsp; >>junk.c</tt>
<br><tt>&nbsp;echo "int WINAPI dll_main(HANDLE a, DWORD reason, void *q)"
>>junk.c</tt>
<br><tt>&nbsp;echo "{ return 1; }"&nbsp;&nbsp;&nbsp; >>junk.c</tt>
<br><tt>libservice.dll: $(OBJS) junk.o service.def</tt>
<br><tt>&nbsp;$(RM) libservice.a</tt>
<br><tt>&nbsp;$(RM) libservice.dll</tt>
<p><tt>&nbsp;if [ -f $(BASE_COUNTER) ]; then true; \</tt>
<br><tt>&nbsp;else echo 0x67000000 > $(BASE_COUNTER); fi</tt>
<br><tt>&nbsp;dllwrap -s --def service.def --output-lib libservice.a -o
libservice.dll $(OBJS) junk.o $(REQUIREDLIBS) -image-base `cat $(BASE_COUNTER)`</tt>
<br><tt>&nbsp;IMAGE_LENGTH=`objdump -x libservice.dll |awk '/SizeOfImage/
{print "0x"$$2}'`; \</tt>
<br><tt>&nbsp;export IMAGE_LENGTH=`expr '(' \`printf %u $$IMAGE_LENGTH\`
/ 65536 + 1 ')' '*' 65536` ; \</tt>
<br><tt>&nbsp;export IMAGE_BASE=`cat $(BASE_COUNTER)`; \</tt>
<br><tt>&nbsp;printf 0x%x `expr \`printf %u $$IMAGE_BASE\` + $$IMAGE_LENGTH`
> $(BASE_COUNTER)</tt>
<br><tt>&nbsp;$(_NULLCMD_)</tt>
<br>----------------------------
<p>The problem is that I don't have any service-def.cpp, and I don't know
the correct format for it.
<p>When I write my own 'service.def' and exclude the 'service.def' rule
from the makefile, it fails with:
<br>dlltool: unrecognized option `--exclude-symbol=_cygwin_dll_entry AT 12'
<p>My dllwrap is version 0.2.4 and dlltool 2.9.4.
<p>When I copy the 'dllwrap' line to the command line it runs without error
(surprisingly), but the nm says 'No symbols in "libservice.dll"'.
<p>Has anyone been though this sort of thing before?</html>

--------------214511E6729F99BAED54F939--

- Raw text -


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