-
Help in wrapper dll
Hi guys,
I'm developing an app in VB with a provided DLL from 3rd party. The SDK they provided includes a .dll file, .h file and .lib file, however this dll was written in CDECL calling convention which is unable to use in VB. So I started to do the wrapping DLL in STDCALL in C++ that calling functions from existing DLL, but my knowledge in C++ is very limited and I have no idea where should I start it with.
Any guidance would be highly appreciate.
Cheers
-
Re: Help in wrapper dll
Well, the wrapper can be straight "C"...no need for objects.
You just create one function for every function in the DLL (at least those you are going to use). Give it the same parameters and return types, and just add a prefix/suffix to the function name.....
There really is no "programming" involved...just a bunch of typing....
-
Re: Help in wrapper dll
Thanks for your reply, just wanna make sure I'm not off track, this is what i've been doing:
- First, i created a empty dll project in VS C++, included the existing .h file and linked .lib file. This is code of the existing .h file:
Code:
#define IVCSDK68_API extern "C" __declspec(dllimport) '<=== original was dllexport, I changed it to dllimport
IVCSDK68_API int IVCSDK68_InitSDK();
- Next, I made a .h file for my tempting DLL (I called it DLL4VB.h), and declarations are:
Code:
int __stdcall VB_InitSDK();
- Next, I created a .cpp file
Code:
#include "IEIDLL4VB.h"
#include "IVCSDK68.h"
int __stdcall VB_InitSDK()
{
return IVCSDK68_InitSDK;
}
So is that the right way of doing it?
Thanks heaps to TheCPUWizard