Subject: Re: NEED HELP: linking an exe with windows lib files
From: [email-masked] ("Mikey")

22 Apr 1997 03:54:43 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_01BC4EC1.EE8CF0C0"
X-Mailer: Microsoft Outlook Express 4.71.0544.0
Original-To: "John A. Lewis" <[email-masked]>
Original-Cc: "cygnus" <[email-masked]>
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE Engine V4.71.0544.0
Original-Sender: [email-masked]

This is a multi-part message in MIME format.

------=_NextPart_000_01BC4EC1.EE8CF0C0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

You have 2 choices that I know of, use MS link32.exe, or build .def =
files, and from that make a libname.a type library, enclosed is a script =
to make .def files from .lib files, if You, or anyone else who reads =
this has a copy of crtdll.lib, or oldnames.lib, please run this script =
on it and post the resulting .def file back to the list or to Me ;^).
to make the library itself, run
dlltool --as=3Das -k --dllname "name".dll --output-lib "name".a --def =
"name".def
where "name" is the name of the dll you are linking to.
#!/bin/sh

tlow(){
echo $1|tr A-Z a-z
}

if [ x"$1" =3D x"" ];then
echo "shell script to generate .def files from .LIB files
$0 filename ..."
exit 0
else
for file in $*;do
=20
echo LIBRARY `basename $file .LIB` \
> `tlow \`basename $file .LIB\`.def`; \
echo EXPORTS >> `tlow \`basename $file .LIB\`.def`; \
nm --extern-only $file |egrep '^........ [TR]' \
|fgrep -v '\$AA C@_0 @@' \
|sort \
|sed -e 's/[^_]*_//' \
-e 's/[^?]*?//' \
>> `tlow \`basename $file .LIB\`.def`;
done
fi

# T=3D .text section R=3D readonly .data section (exported variables)
# $AA C@_0 @@ exported structure/internal function definitions (nm's =
bust I think ;^)
=20
Come on gang...someone must know what to do about this...  Help me out
here!

John A. Lewis wrote:
>
> I am trying to build an executable which links in some libraries which
> are intended for windows.  The symbols in these libraries have the _ =
in
> front of them, which gcc seems to handle, and @4, @8, @12, etc. behind
> them, which gcc does not seem to handle.  I am kind of a novice here, =
so
> I have no idea what to do about this.
>
> Any recommendations on how to fix this?
>
> Thanks,
> --John Lewis

------=_NextPart_000_01BC4EC1.EE8CF0C0
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
<HTML>
<HEAD>
<META content=3Dtext/html;charset=3Diso-8859-1 =
http-equiv=3DContent-Type>
<HTML><HEAD><META content=3D"text/html; charset=3Diso-8859-1"=20
http-equiv=3DContent-Type>
<META content=3D'"Trident 4.71.0544.0"' name=3DGENERATOR>

</HEAD>
<BODY><FONT face=3DArial size=3D2>
<P><FONT face=3DSystem size=3D-1>You have 2 choices that I know of, use =
MS=20
link32.exe, or build .def files, and from that make a libname.a type =
library,=20
enclosed is a script to make .def files from .lib files, if You, or =
anyone else=20
who reads this has a copy of crtdll.lib, or oldnames.lib, please run =
this script=20
on it and post the resulting .def file back to the list or to Me =
;^).</FONT></P>

<P><FONT face=3DSystem size=3D-1>to make the library itself, run</FONT>

<P><FONT face=3DSystem size=3D-1>dlltool --as=3Das -k --dllname =
&quot;name&quot;.dll=20
--output-lib &quot;name&quot;.a --def &quot;name&quot;.def</FONT>

<P><FONT face=3DSystem size=3D-1>where &quot;name&quot; is the name of =
the dll you=20
are linking to.</FONT>

<P><FONT face=3DSystem size=3D-1>#!/bin/sh<BR>&nbsp;
<BR>
tlow(){<BR>
echo $1|tr A-Z a-z<BR>
}<BR>&nbsp;
<BR>
if [ x&quot;$1&quot; =3D x&quot;&quot; ];then<BR>
echo &quot;shell script to generate .def files from .LIB files<BR>
$0 filename ...&quot;<BR>
exit 0<BR>
else<BR>
for file in $*;do<BR>
&nbsp;</FONT>

<P><FONT face=3DSystem size=3D-1>echo LIBRARY `basename $file .LIB` =
\<BR>
&gt; `tlow \`basename $file .LIB\`.def`; \<BR>
echo EXPORTS &gt;&gt; `tlow \`basename $file .LIB\`.def`; \<BR>
nm --extern-only $file |egrep '^........ [TR]' \<BR>
|fgrep -v '\$AA C@_0 @@' \<BR>
|sort \<BR>
|sed -e 's/[^_]*_//' \<BR>
-e 's/[^?]*?//' \<BR>
&gt;&gt; `tlow \`basename $file .LIB\`.def`;<BR>
done<BR>
fi<BR>&nbsp;
<BR>
# T=3D .text section R=3D readonly .data section (exported =
variables)<BR>
# $AA C@_0 @@ exported structure/internal function definitions (nm's =
bust I=20
think ;^)<BR>
&nbsp;</FONT>

<P><FONT face=3DSystem size=3D-1></FONT><FONT face=3DSystem =
size=3D-1>Come on=20
gang...someone must know what to do about this...&nbsp; Help me out<BR>
here!<BR>
<BR>
John A. Lewis wrote:<BR>
&gt;<BR>
&gt; I am trying to build an executable which links in some libraries =
which<BR>
&gt; are intended for windows.&nbsp; The symbols in these libraries have =
the _=20
in<BR>
&gt; front of them, which gcc seems to handle, and @4, @8, @12, etc. =
behind<BR>
&gt; them, which gcc does not seem to handle.&nbsp; I am kind of a =
novice here,=20
so<BR>
&gt; I have no idea what to do about this.<BR>
&gt;<BR>
&gt; Any recommendations on how to fix this?<BR>
&gt;<BR>
&gt; Thanks,<BR>
&gt; --John Lewis</FONT></P>
</FONT>
</BODY></HTML>

------=_NextPart_000_01BC4EC1.EE8CF0C0--

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".