VCGuy
February 8th, 2000, 09:32 AM
I have a problem linking a VB app to a C++ Win32 DLL. The dll exports a simple function. The header in the cpp file looks like
this
#ifdef TESTDLL2_EXPORTS
#define TESTDLL2_API __declspec(dllexport)
#else
#define TESTDLL2_API __declspec(dllimport)
#endif
extern "C" TESTDLL2_API int fnTestdll2(int x);
I'm trying to use this test dll from a VB app in which I have declared the function like so
Private Declare Function fnTestdll2 Lib "Testdll2" _
(ByVal val As Integer) As Integer
Whenever I try to use the function I get a runtime error '49' saying 'Bad calling convention'. I've tried changing the values to long and get the same result.
If I make the function void it works from the VB client if I use the function without passing a parameter. Does anyone know how to fix this?
this
#ifdef TESTDLL2_EXPORTS
#define TESTDLL2_API __declspec(dllexport)
#else
#define TESTDLL2_API __declspec(dllimport)
#endif
extern "C" TESTDLL2_API int fnTestdll2(int x);
I'm trying to use this test dll from a VB app in which I have declared the function like so
Private Declare Function fnTestdll2 Lib "Testdll2" _
(ByVal val As Integer) As Integer
Whenever I try to use the function I get a runtime error '49' saying 'Bad calling convention'. I've tried changing the values to long and get the same result.
If I make the function void it works from the VB client if I use the function without passing a parameter. Does anyone know how to fix this?