delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/10/28/20:58:11

From: mvoss AT kuttig DOT com
Subject: Antwort: link against .lib
28 Oct 1998 20:58:11 -0800 :
Message-ID: <C12566AB.002AF5AD.00.cygnus.gnu-win32@notes.kuttig.com>
Mime-Version: 1.0
To: schmolli AT t-online DOT de (T-ONLINE)
Cc: gnu-win32 AT cygnus DOT com

Hi there! (oder Hallihallo, but this is an English mailing list ;-)

You cannot directly link against a DLL, and I don't think you can use
*.LIBs at all.

You need two things:

First step:
In order to link against a DLL, you need an "IMPDEF" utility, I recommend
PEXPORTS by Anders Norlander.
He posted a mail about this yesterday, the subject was "Generating .DEF
files from .DLLs". He gives you a pointer to his
home page, along with some info what PEXPORTS does. (BTW.: Thanks for the
credits, Anders!)



Alternatively, check it out directly from here (if the T-Online browser can
manage this ;-)

http://hem2.passagen.se/anorland/





Second step:
DLLTOOL.EXE, which comes with CDK B19, CyWin32 Usertools B19 or
EGCS-1.1-MinGW32.




This is how it's all put together:

(Unzip all the software, of course, and check your paths).



Execute the following from the command prompt:
"PEXPORTS.EXE -h foo.h foobar.dll >foobar.def"

Foo and foobar represent any filenames you wish - providing that you have a
*.H file to use the
corresponding DLL. This command line will create a *.DEF file which DLLTOOL
can use.




Then, execute this (again, substitute foo and foobar by what you want to
process):
"DLLTOOL.EXE --input-def foobar.def --dllname foobar.dll --output-lib
libfoobar.a"

(If you get a "syntax error in file foobar.def", remove the first line of
this file via EDIT.EXE or Notepad -
the first line should be EXPORTS, and nothing with the DLL's name in it.
This is a bug in DLLTOOL, AFAIK.)



The resulting libfoobar.a (important: the format libxxx.a is mandatory,
e.g. abn OpenGL32.dll should become libOpenGL32.a) can now be linked into
your program, and if it's not a real bagbite, it will work just fine.


Small example (if I wanted to link OpenGL from SGI (it's a registered
trademark and blablah):
  pexports -h gl.h opengl32.dll >opengl32.def
  dlltool --input-def opengl32.def --dllname opengl32.dll --output-lib
libopengl32.a


All this should work fine with your label-printer's DLLs.


Regards,
 Moritz Voss
 Kuttig Computearnwendungen GmbH Troisdorf (http://www.kuttig.com)
 mvoss AT kuttig DOT com or tigerbyte AT tronet DOT de
 http://www.geocities.com/siliconvalley/lab/3274 or
http://www.open.lv/home/spirit.link


-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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