This is the mail archive of the cygwin@sourceware.cygnus.com 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]

Antwort: link against .lib


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@kuttig.com or tigerbyte@tronet.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@cygnus.com" with one line of text: "help".


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