Hi, I recently was trying to learn how to write DLLs and was doing ok until I ran across this interesting problem. It seems that the function is not receiving the last argument.
Here is my code for the dll
#include "stdafx.h"
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}
_declspec (dllexport) int _stdcall sum(int x , int y)
{
return (x+y);
}
and here is my .def file
LIBRARY example1
EXPORTS
sum @1
I am using visual studio C++ 2005 to write the dll and am using VB to call it. When I call sum it returns the value of x.. if I tell the dll to return y I always get 0 ... I can't figure it why. When I added more arguments to the function I found that it was always the last variable that always is received as 0. What is happening? What am I doing wrong?