This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: NEED HELP: linking an exe with windows lib files


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=as -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" = x"" ];then
echo "shell script to generate .def files from .LIB files
$0 filename ..."
exit 0
else
for file in $*;do
 

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= .text section R= readonly .data section (exported variables)
# $AA C@_0 @@ exported structure/internal function definitions (nm's bust I think ;^)
 

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]