This is the mail archive of the cygwin 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]
Other format: [Raw text]

Re: dll link error using Cygwin gcc

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
> 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:
Problem reports:

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