From: <dan...@ya...> - 2001-06-29 02:30:57
|
--- Mumit Khan <khan@NanoTech.Wisc.EDU> wrote: > On Thu, 28 Jun 2001, Rob Light wrote: > > > Here's my question: How do I get the linker to output a Win32 EXE > which > > dynamically links at run-time (under Windows) with a third party > Win32 > > DLL? > > Typical first step is to create an import library. Note that GNU > linker > is smart enough to directly link with the DLL, so you can just > specify > the DLL file directly on the command line. I'm more used to using an > import library, so don't really know what the caveats are in linking > directly to a DLL. Don't try linking directly with DLL if stdcall (PASCAL) names are only visible as undecorated alias. This includes most most of w32api. For example setupapi.dll exports a function SearchForInfFile. To link against this lib you need an implib with the stdcall decoration, ie, SearchForInfFile@24. Also some Pascal compilers use different name decoration (add _ to start of external name. Here again you will need an implib. Danny > MSVC as far as I know can't do that, and you have > to > have an import library. > > Of course, I'm assuming that the 3rd party DLL is not C++, in which > case > it simply won't work. > > > The linker is complaining about undefined references which are > located > > in the third party Win32 DLL. Here are the commands: > > > > i386-mingw32msvc-gcc -c -I/home/rlight/test/include -o test.o > test.cpp > > i386-mingw32msvc-gcc -c -I/home/rlight/test/include -o testmain.o > > testmain.cpp > > i386-mingw32msvc-gcc -mwindows -o test.exe test.o testmain.o > > Add the DLL at the end of the command line. > > Mumit > > > > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options at: > http://lists.sourceforge.net/lists/listinfo/mingw-users _____________________________________________________________________________ http://messenger.yahoo.com.au - Yahoo! Messenger - Voice chat, mail alerts, stock quotes and favourite news and lots more! |