
Signature
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Thanks again for your response.
Do you mean that when the export statement is
DWORD __declspec (dllexport) __stdcall FunctionName(Datatype
Parameter1);
the function declaration in the header file needs to be
DWORD __declspec Functionname(Datatype Parameter1);
But won't such a declaration still give linker errors, since the lib file
would be using __stdcall calling convention in the definition of the function?
So, the question again is, how to export functions which use __stdcall
calling convention?
Regards.
> >Declaring the export function as follows:
> >
[quoted text clipped - 12 lines]
>
> Dave
David Lowndes - 17 Oct 2004 09:36 GMT
>Do you mean that when the export statement is
>DWORD __declspec (dllexport) __stdcall FunctionName(Datatype
>Parameter1);
>
>the function declaration in the header file needs to be
>DWORD __declspec Functionname(Datatype Parameter1);
No.
When you build your DLL, the header & source file needs to be the
same:
DWORD __declspec (dllexport) __stdcall FunctionName(Datatype
Parameter1);
otherwise you'll get that redefinition error you are seeing.
When you use the header file from the project where you'll call the
function, it needs to be:
DWORD __declspec (dllimport) __stdcall FunctionName(Datatype
Parameter1);
Have a look at that MSDN topic I referred you to originally, that
shows how to use a preprocessor definition to get the correct form of
declspec (dllexport/dllimport) in both circumstances.
Dave

Signature
MVP VC++ FAQ: http://www.mvps.org/vcfaq
sm - 19 Oct 2004 06:39 GMT
I'll try that.
Thanks.
> >Do you mean that when the export statement is
> >DWORD __declspec (dllexport) __stdcall FunctionName(Datatype
[quoted text clipped - 24 lines]
>
> Dave