This is the mail archive of the
mailing list for the Cygwin project.
Re: dll link error using Cygwin gcc
- From: Brian Dessent <brian at dessent dot net>
- To: cygwin at cygwin dot com
- Date: Tue, 12 Jun 2007 08:59:11 -0700
- Subject: Re: dll link error using Cygwin gcc
- References: <000001c7ad08$f72b9280$e582b780$@email@example.com>
- Reply-to: cygwin at cygwin dot com
Harold Mills wrote:
> I'm trying to use Cygwin's gcc to link a small test program (Hello.c)
> against a commercial DLL (ibmeci.lib), the source code for which I don't
> have. I followed the instructions at www.cygwin.com/cygwin-ug-net/dll.html
> to try to build a Cygwin-compatible import library:
> echo EXPORTS > ibmeci.def
> nm ibmeci.lib | grep ' T _' | sed 's/.* T _//' >> ibmeci.def
> dlltool --def ibmeci.def --dllname ibmeci.lib --output-lib ibmeci.a
This is equivalent to "cp ibmeci.lib ibmeci.a", i.e. it's wasted
effort. They're the same file format. You can just use ibmeci.lib.
> I get the ld error message "undefined reference to '_eciSpeakText'". The
> Hello.c program calls a function 'eciSpeakText'.
If you're getting undefined reference to _eciSpeakText that means the
function is declared with the cdecl (default) calling convention in
eci.h. However, the library probably uses stdcall since its symbols are
decorated with @nn, so you need to fix the header before anything else.
Both user and library must agree on calling convention as well as symbol
decoration before anything will work. Usually the two go hand-in-hand,
but sometimes you get oddball combinations like
stdcall-without-@nn-decoration which requires you to cook up an import
lib with the appropriate aliases.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html