CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2003
    Posts
    4

    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

  2. #2
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    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....
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  3. #3
    Join Date
    Jun 2003
    Posts
    4

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured