delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/02/15/04:27:52

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
X-Authentication-Warning: james.esem.com: news set sender to nittka AT esem DOT com using -f
Path: james.esem.com!not-for-mail
From: Oliver Nittka <nittka AT esem DOT com>
Subject: __stdcall in 3rd-party dll
Date: 15 Feb 2000 10:17:53 +0100
Organization: ESEM Gmbh, Markdorf/Germany
Lines: 66
Message-ID: <uya8m3jum.fsf@esem.com>
NNTP-Posting-Host: edp22.esem.com
X-Trace: james.esem.com 950606275 16270 192.168.1.22 (15 Feb 2000 09:17:55 GMT)
X-Complaints-To: news AT james DOT esem DOT com
NNTP-Posting-Date: 15 Feb 2000 09:17:55 GMT
X-Newsreader: Gnus v5.7/Emacs 20.4
Xref: james.esem.com mailing-lists.cygwin:978
To: cygwin AT sourceware DOT cygnus DOT com

hi everyone !

after some diggin' in the mailing-list archives and on dejanews, i've
got some insight in the following situation, but still don't know how
to resolve it, perhaps somebody can give me a hit over the head with
the appropriate literature ;-)

i've got me a DLL (gpib-32.dll from national instruments), where i
want to link against some functions (ibdev, ibwrt, ibrd: perhaps
somebody's got that dll and wants to look for him/herself)

according to the headerfile, those functions are __stdcall, but they
are exported from the dll undecorated (without @nn).

- if i delete __stdcall from the header, my program crashes as soon as
  it calls ibdev (stack corruption i suppose)

- if i leave the .h-file as is, i get unresolved symbols ibdev AT 24,
  ibwrt AT 16 etc.

- if i create myself an import-library, using a decorated .def-file,
  it still crashes (does it link to the correct functions, anyway ?)
  using an undecorated import-lib still gives me unresolved symbols.

- giving --enable-stdcall-fixup to dlltool only seems to work when i
  *create* a dll and leave the .def-file undecorated, but i hadn't had
  any luck when using it when linking a foreign dll


some words about what i'm trying to do:
it's an extension to tcl (8.2.2) on windows that allows me to talk to
gpib-devices (unsing national's dll). i've already got it running
using LoadLibrary() and GetProcAddress(), but for the sake of
maintainability i would prefer to link against the dlls.


excerpt from tclgpib.c:
extern int __stdcall ibdev  (int ud, int pad, int sad, int tmo, int eot, int eos);
extern int __stdcall ibwrt  (int ud, void *buf, long cnt);
extern int __stdcall ibrd   (int ud, void *buf, long cnt);


excerpt from Makefile:
        dllwrap -o tclgpib.dll --def tclgpib.def -e "_DllMain AT 12" \
              tclgpib.o  dllinit.o \
              --enable-stdcall-fixup --target=mingw32 -mno-cygwin \
              //d/winnt/system32/gpib-32.dll //d/Programme/Tcl/bin/tcl82.dll

(dllinit.c is from mumit)

the tools are all installed from cygwin1.0-cd

hope somebody can make sense of all that ;-) 
if someone's got an idea for a patch for ld so i can use
--enable-stdcall-fixup when linking against a dll i would me *very*
happy :-))


TIA !
  -- oly
-- 
Oliver Nittka              | nittka AT esem DOT com
ESEM Grünau GmbH & Co. KG  | http://www.esem.com
Dornierstraße 6            | phone: +49 7544 9583-25
88677 Markdorf / Germany   | fax:   +49 7544 9583-60


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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