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: Newbie trying to link with .lib


Hi Tom,

I just read that section of the FAQ the other day and found it to be
interestingly confusing myself.

Try this:

echo EXPORT > mylib.def; nm --demangle --defined-only | grep ' T ' |
sed 's/.* T //' >> mylib.def

dlltool --dllname mylib.dll --def mylib.def --output-lib libmylib.a

gcc -o myprog myprog.c -lmylib

Note: If this doesn't search the archives for more info.


---Tom Lee <tlee@argoneng.com> wrote:
>
> Hello all:
> 
> I am running the Cygnus Win 32 B19 on my NT machine, and
> I'm trying to link some code against library files from
> another package with the extension .lib.  But when I try
> to link with my .lib file, I still get unresolved symbols
> even though I know they're in there (by using the 'nm'
> command in the bash shell).  
> 
> I realize that the FAQ has an "answer" as to how to do this, 
> but I don't understand the answer.  I also tried looking this 
> up in the archives, but met with little success.  Is there a 
> simple way for linking against .lib files (which makes sense)?
> Am I missing some commands/arguments?
> 
> Things to note:
> 
> - My basic command line goes something like this:
>   > gcc -I../include -L../lib TestMain.cc ../lib/patapp.lib
> - I tried doing an 'nm' command in the bash shell on my
>   .lib files and was successful in seeing mangled symbols,
>   so I know that at least 'nm' thinks the .lib file is in
>   the correct format.
> - I also tried a 'ar -t' on my .lib file, and it listed all
>   of the .obj files which comprise this .lib file.  But I
>   don't know how to get this to link with my code.
> - The FAQ makes mention of executables "LIB.EXE" and "LINK.EXE".
>   I didn't get these with my Cygwin32.  Should I have?  Also,
>   the FAQ talks about making a dummy LibMain and creating a
>   .def file.  What does this mean, or should I even care?
> - I'm new to NT; I've done 99% of my programming on Unix ;-)
> 
> Thanks in advance,
> Tom Lee
> tlee@argoneng.com
> -
> For help on using this list (especially unsubscribing), send a
message to
> "gnu-win32-request@cygnus.com" with one line of text: "help".
> 

==
-                  \\||//
-------------o0O0--Earnie--0O0o--------------
--          earnie_boyd@yahoo.com          --
-- http://www.freeyellow.com/members5/gw32 --
----------------ooo0O--O0ooo-----------------

PS: Newbie's, you should visit my page.
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


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