Re: LINK error
- From: nyryder <nyryder@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 2 Feb 2009 10:49:01 -0800
Thanks for your quick response. Just to do a workaround with the header file
as you suggested , i did the following way
I defined two MACROs
#define DLLEXPORT __declspec(dllexport)
#define DLLCALL __stdcall
I changed the header files declaration as
DLLEXPORT retvalue DLLCALL func();
It did not help me. The linker complains with the LNK2019 error(unresolved
external symbol).
But when i changed the DLLCALL to __cdecl, it compiled with out an error in
WINDDK, but when i run the application an error window poped up, and says
"...It is not a valid win32 application".
Any idea...
"Maxim S. Shatskih" wrote:
.1. Is it possible to link the 3rd party library to my DDK application?
If it is built with GNU make - then it is probably open-source, in which case I would rework its source/build scripts so it will also be buildable with WDK.
Building closed-source Windows code with non-Microsoft tools is a very bad idea from the LIB vendor.
Cross-linking between different build tools can have issues. Calling convention is one of the most major of them. Look at the .H file for the LIB. Are the functions declared explicitly with __stdcall or with __cdedl? they should be. This is, BTW, even the issue between Visual Studio (__cdecl default) and WDK (__stdcall default).
C++ can add another can of worms there, a huge one, this is not only about the name mangling, but also about the vmtable/vbtable layout and runtime support for exceptions and RTTI.
So:
- if there is the source - build it using WDK too, avoid GNU tools at all
- if there is no source and this is C, not C++ - look at calling convention, there is a good probability it will be enough for the things to work
- if there is no source and this is C++ - you're probably hosed completely.
--
Maxim S. Shatskih
Windows DDK MVP
maxim@xxxxxxxxxxxxxxxx
http://www.storagecraft.com
- Follow-Ups:
- Re: LINK error
- From: Maxim S. Shatskih
- Re: LINK error
- From: nyryder
- Re: LINK error
- References:
- LINK error
- From: nyryder
- Re: LINK error
- From: Maxim S. Shatskih
- LINK error
- Prev by Date: Re: Filter Driver Causing Reboot
- Next by Date: Re: Filter Driver Causing Reboot
- Previous by thread: Re: LINK error
- Next by thread: Re: LINK error
- Index(es):
Relevant Pages
|