delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/06/12/11:59:34

X-Spam-Check-By: sourceware.org
Message-ID: <466EC2CF.E39316C1@dessent.net>
Date: Tue, 12 Jun 2007 08:59:11 -0700
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: dll link error using Cygwin gcc
References: <000001c7ad08$f72b9280$e582b780$@mills AT novaspeech DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
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

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- AT nn-decoration which requires you to cook up an import
lib with the appropriate aliases.

Brian

--
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