delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/06/27/15:37:04

X-Spam-Check-By: sourceware.org
Message-ID: <11331072.post@talk.nabble.com>
Date: Wed, 27 Jun 2007 12:36:43 -0700 (PDT)
From: km4hr <km4hr AT netscape DOT net>
To: cygwin AT cygwin DOT com
Subject: How to link with third party libraries using gcc
MIME-Version: 1.0
X-Nabble-From: km4hr AT netscape DOT net
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

I do a fair amount of C programming on Unix but almost none on Windows. I
know almost nothing about Windows libraries. I'd be happy if I never had to
deal with them at all. But I have a need. 

I thought Windows shared libraries were indentified by a ".dll" extension.
However I have a commercial product installed that has a C programming
interface. It's libraries have a ".lib" extension. I am totally lost as to
how to link my program to these files.

The Cygwin User's Guide contains an extremely brief section on linking
against DLL's (section 4.3.2). It shows how to use "nm" to create a  ".def"
file and then "dlltool" to create a ".a" file. I don't know how this relates
to the ".lib" files that I have.

The command given in the User's Guide create the ".def" file is as follows:

nm foo.dll | grep ' T _' | sed 's/.* T _//' >> foo.def

I don't have a ".dll" file but I noticed that my ".lib" files have lines
containing the string " T _" .  So I ran the above "nm" command using my
".lib" files. The resulting ".def" file won't work with the second step
which is:

dlltool --def foo.def --dllname foo.dll --output-lib foo.a

The error I get from the above command says that the ".def" file has
incorrect format.

In summary, I'm totally lost. I have no idea what's going on here. Does any
of this make sense to you guys.? Can you tell me how to link against a
".lib" file?

Thanks!

-- 
View this message in context: http://www.nabble.com/How-to-link-with-third-party-libraries-using-gcc-tf3990417.html#a11331072
Sent from the Cygwin Users mailing list archive at Nabble.com.


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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