[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Linking vs. a *.lib-file on windows (cygwin / MinGW)
From: |
Andre Poenitz |
Subject: |
Re: Linking vs. a *.lib-file on windows (cygwin / MinGW) |
Date: |
Sat, 21 Jun 2008 17:36:06 +0200 |
User-agent: |
tin/1.9.2-20070201 ("Dalaruan") (UNIX) (Linux/2.6.22-14-generic (i686)) |
Lars Uffmann <aral@nurfuerspam.de> wrote:
> Hi everyone,
>
> I am trying to use an Ansi-C-compatible API provided by a closed-source
> software, and I am badly failing to link against the library, which I am
> willing to blame on my inexperience with linker settings.
>
> What I have is:
> - the header files for the API
> - the *.dll files in my system32 folder
> - the *.lib file for the one dll that contains the function I want to use.
>
> My understanding is that I need to
> - include the header files in my source (as if it was my own code and I
> had the cpp-files also)
> - use the function as intended in my code and as defined in the header
> - link against the libfile
> - have the dll available at runtime
>
> So how do I link against the libraryname.lib file - which command line
> option for the g++ linker is that?
>
> Grateful for any help!
Poking into the dark: Do the C headers have something like 'extern "C"'
mentioned somewhere?
If not, try
extern "C" {
#include "the_software_C_header.h"
}
A C++ compiler typically "mangles" the function names it enconters, so
the linker might not be able to match them with the symbols from the
library.
Andre'