delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/08/18/13:13:56

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
From: "Suhaib Siddiqi" <ssiddiqi AT ipass DOT net>
To: "Richard" <hicklinr AT mcd DOT alcatel DOT be>
Cc: "Cygwin AT Sourceware DOT Cygnus DOT Com" <cygwin AT sourceware DOT cygnus DOT com>
Subject: RE: Imake and DLLs under Cygwin
Date: Wed, 18 Aug 1999 13:06:34 -0400
Message-ID: <NDBBLHPPKKBKPBLLMFJBEEMOCBAA.ssiddiqi@ipass.net>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
In-Reply-To: <37BAE433.C330099C@mcd.alcatel.be>
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Importance: Normal

------=_NextPart_000_002A_01BEE97A.7F6B1A40
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

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 AT sourceware DOT cygnus DOT com
[mailto:cygwin-owner AT sourceware DOT cygnus DOT com]On Behalf Of Richard
  Sent: Wednesday, August 18, 1999 12:50 PM
  To: cygwin AT sourceware DOT cygnus DOT 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,$(ICONFIGFIL
ES)) @@\
  ---------------------------

  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?


------=_NextPart_000_002A_01BEE97A.7F6B1A40
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR></HEAD>
<BODY>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D780290317-18081999>First=20
you need to figure out the export symbols from your code and=20
write</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D780290317-18081999>service-def.cpp.</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D780290317-18081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D780290317-18081999>You=20
can grab the updates cygwin.cf, cygwin.rules and cygwin.tmpl, plus=20
Imake.cf</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D780290317-18081999>from=20
cygwin-xfree source tree.&nbsp; It is at=20
sourceware.cygnus.com/pub/cygwin/xfree</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN =
class=3D780290317-18081999>and=20
would be more helpfull if you direct the further questions from that =
source tree=20
to</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D780290317-18081999>cygwin-xfree mailing =
list.</SPAN></FONT></DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D780290317-18081999></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT color=3D#0000ff face=3DArial size=3D2><SPAN=20
class=3D780290317-18081999>Suhaib</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<BLOCKQUOTE=20
style=3D"BORDER-LEFT: #0000ff 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: =
0px; PADDING-LEFT: 5px">
  <DIV align=3Dleft class=3DOutlookMessageHeader dir=3Dltr><FONT =
face=3DTahoma=20
  size=3D2>-----Original Message-----<BR><B>From:</B>=20
  cygwin-owner AT sourceware DOT cygnus DOT com=20
  [mailto:cygwin-owner AT sourceware DOT cygnus DOT com]<B>On Behalf Of=20
  </B>Richard<BR><B>Sent:</B> Wednesday, August 18, 1999 12:50 =
PM<BR><B>To:</B>=20
  cygwin AT sourceware DOT cygnus DOT com<BR><B>Subject:</B> Imake and DLLs under=20
  Cygwin<BR><BR></DIV></FONT>I have an application which I've =
successfully=20
  rebuilt on Solaris.&nbsp; It was configured with imake. <BR>I now have =
a=20
  requirement to port it to Cygwin.&nbsp; Using the imake from my X11=20
  distribution there have been various errors due to the Cygwin =
configuration=20
  files (cygwin.tmpl, cygwin.rules ... in X11R6.4/lib/X11/config) being =
somewhat=20
  out-of-date, but these have been solved.=20
  <P>The problem comes with the attempt to produce a 'shared library' =
(DLL on=20
  Cygwin of course).&nbsp; The Imakefile uses the imake rule=20
  SharedLibraryTarget(...): <BR>--------------------------- =
<BR><TT>#define=20
  =
SharedLibraryTarget(libname,rev,solist,down,up)&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  @@\</TT>=20
  =
<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;=20
  @@\</TT> <BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
@@\</TT>=20
  =
<BR><TT>CppFileTarget(libname.def,libname-def.cpp,-DLIBRARY_VERSION=3Drev=
,$(ICONFIGFILES))=20
  @@\</TT> <BR>---------------------------=20
  <P>which produces the following make rules:=20
  <P>--------------------------- <BR><TT>service.def::&nbsp; =
service-def.cpp=20
  $(ICONFIGFILES)</TT> <BR><TT>&nbsp;$(RM) $@</TT> =
<BR><TT>&nbsp;$(CPP)&nbsp;=20
  -DLIBRARY_VERSION=3D1 &lt;service-def.cpp | sed -e '/^#&nbsp; =
*[0-9][0-9]*&nbsp;=20
  *.*$$/d' -e\ '/^XCOMM$$/s//#/' -e '/^XCOMM[^a-zA-Z0-9_]/s/^XCOMM/#/'=20
  &gt;$@</TT>=20
  <P><TT>clean::</TT> <BR><TT>&nbsp;$(RM) service.def</TT>=20
  <P><TT>junk.c:</TT> <BR><TT>&nbsp;echo "#include=20
  &lt;cygwin/cygwin_dll.h&gt;"&nbsp; &gt;junk.c</TT> <BR><TT>&nbsp;echo=20
  "DECLARE_CYGWIN_DLL(dll_main);"&nbsp; &gt;&gt;junk.c</TT> =
<BR><TT>&nbsp;echo=20
  "int WINAPI dll_main(HANDLE a, DWORD reason, void *q)" =
&gt;&gt;junk.c</TT>=20
  <BR><TT>&nbsp;echo "{ return 1; }"&nbsp;&nbsp;&nbsp; =
&gt;&gt;junk.c</TT>=20
  <BR><TT>libservice.dll: $(OBJS) junk.o service.def</TT> =
<BR><TT>&nbsp;$(RM)=20
  libservice.a</TT> <BR><TT>&nbsp;$(RM) libservice.dll</TT>=20
  <P><TT>&nbsp;if [ -f $(BASE_COUNTER) ]; then true; \</TT> =
<BR><TT>&nbsp;else=20
  echo 0x67000000 &gt; $(BASE_COUNTER); fi</TT> <BR><TT>&nbsp;dllwrap -s =
--def=20
  service.def --output-lib libservice.a -o libservice.dll $(OBJS) junk.o =

  $(REQUIREDLIBS) -image-base `cat $(BASE_COUNTER)`</TT>=20
  <BR><TT>&nbsp;IMAGE_LENGTH=3D`objdump -x libservice.dll |awk =
'/SizeOfImage/=20
  {print "0x"$$2}'`; \</TT> <BR><TT>&nbsp;export IMAGE_LENGTH=3D`expr =
'(' \`printf=20
  %u $$IMAGE_LENGTH\` / 65536 + 1 ')' '*' 65536` ; \</TT> =
<BR><TT>&nbsp;export=20
  IMAGE_BASE=3D`cat $(BASE_COUNTER)`; \</TT> <BR><TT>&nbsp;printf 0x%x =
`expr=20
  \`printf %u $$IMAGE_BASE\` + $$IMAGE_LENGTH` &gt; $(BASE_COUNTER)</TT> =

  <BR><TT>&nbsp;$(_NULLCMD_)</TT> <BR>----------------------------=20
  <P>The problem is that I don't have any service-def.cpp, and I don't =
know the=20
  correct format for it.=20
  <P>When I write my own 'service.def' and exclude the 'service.def' =
rule from=20
  the makefile, it fails with: <BR>dlltool: unrecognized option=20
  `--exclude-symbol=3D_cygwin_dll_entry AT 12'=20
  <P>My dllwrap is version 0.2.4 and dlltool 2.9.4.=20
  <P>When I copy the 'dllwrap' line to the command line it runs without =
error=20
  (surprisingly), but the nm says 'No symbols in "libservice.dll"'.=20
  <P>Has anyone been though this sort of thing before?=20
</P></BLOCKQUOTE></BODY></HTML>

------=_NextPart_000_002A_01BEE97A.7F6B1A40--

- Raw text -


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