I have the same problem when I try and pass more than one variable
ie:
this works:
DLL(mydll):
#include <stdio.h>
#define DllExport __declspec( dllexport )
extern "C" DllExport long myfun(long x);
extern "C" DllExport long myfun(long x)
{
return (x + 200);
Quote:
}
// this passes a value from VB as x to this VCpp 5.0 dll (w/
//_stdcall). then returns x + 200 to VB as a long.
VB part:
Private Declare Function myfun Lib _
"C:\temp\mydll.dll" _
(ByVal x As Long) As Long
But this one does not work for me.
DLL2(mydll)::
#include <stdio.h>
#define DllExport __declspec( dllexport )
extern "C" DllExport long myfun(long x, long y);
extern "C" DllExport long myfun(long x, long y)
{
return (x + y + 200);
Quote:
}
// this passes 2 values from VB as x & y to this VCpp 5.0 dll (w/
//_stdcall). then should returns x + y + 200 to VB as a long. But I
get the dll does not support this function....
VB part:
Private Declare Function myfun Lib _
"C:\temp\mydll.dll" _
(ByVal x As Long, ByVal y As Long) As Long
I hope this helps.. I am stuck also, but only when there are more
than one variable to pass..
If you like I can post explicit directions how to make the DLL..
Garrett
Quote:
>Did you declare your C functions with _stdcall ???
>> Hi, got a problem with calling a simple c++ dll from vb, always got error
>> "bad calling convention", all param-types seem to be correct :(
>> any ideas ?
>> thx, Lasse
>> ---------------------------------------------