Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6215151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:00:10+00:00 2026-05-24T07:00:10+00:00

I am writing a module for a third party application; the application uses __cdecl

  • 0

I am writing a module for a third party application; the application uses __cdecl calling convention.

At the same time, I have a legacy DLL which uses __stdcall calling convention.

Can I create a wrapper that in one end exports __cdecl functions, while in the other end imports __stdcall functions? which other options do I have?

Thanks,

EDIT:

Here is some extra information that my help clarify my situation.

There is a third_party.exe that need to gain access to skeleton.dll. The source code skeleton.dll contains the header file below and compiles using __cdecl.

#ifdef _EXPORTING
  #define DECLSPEC    __declspec(dllexport)
#else
   #define DECLSPEC    __declspec(dllimport)
#endif

#ifdef __cplusplus
   extern "C" {  
#endif

DECLSPEC int ICD_Create(char* id);
...
...
...

Ideally, I would use the skeleton source code to develop my DLL; unfortunately, it would be too time consuming to port my current VB6 legacy code into C++. Given this, I had to hack my VB6 code by following this guideline (It is a work around, but it allows me to use an ActiveX DLL as a standard C DLL).

I am not 100% confident of the modified VB6 calling convention, nor how to modify it. The exercises use __stdcall, and there seem to work fine with a test application I developed. However, when I test it with the third party application, it calls properly certain functions but in other functions it crashes.

The architecture would look like:

Application: ThirdParty.exe (out of your control: Uses __cdecl) 
     |
     |
Plugin module: Skeleton.dll (your code)
     |
     |
Legacy DLL: ModifiedVB6.dll (out of your control: Seem to work with __stdcall)

The legacy DLL generates a dll, lib and def file; No header file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:00:13+00:00Added an answer on May 24, 2026 at 7:00 am

    The DLL will typically come with a header file (.h) and an associated import library (.lib) that deal with the calling conventions, exported function prototypes etc.

    Simply include the header file, link to the import library, and you will be able to call the functions directly.

    That header file will specify that the functions use the __stdcall calling convention. You most definitely do not, and should not, write a separate wrapper DLL. That would be adding a completely gratuitous layer of complexity.


    Having re-read your question, and your comment, I believe that you have the following architecture:

    Application (out of your control)
         |
         |
    Plugin module (your code)
         |
         |
    Legacy DLL (out of your control)
    

    The legacy DLL exports its function using __stdcall. The application imports function from the plugin using __cdecl.

    If that synopsis is correct then of course you must import from the legacy DLL using __stdcall and export to the application using __cdecl. Since those parts of the interface are outside your control you have no option.

    However, I am finding the question and comments very hard to follow. Perhaps I have not fully understood. Feel free to add more information to clarify in an edit to the question.


    Following the update I suspect that your problems are all concerning how to interface the VB6 legacy DLL with your C++ DLL. Since you don’t have a header file (.h) for the VB6 DLL you are presumably writing your own translations.

    If I recall correctly, VB6 only supports __stdcall which is what you are currently using. Your problems are therefore most likely to be due to erroneous translations of the exported VB functions into C++ prototypes.

    I think your best course of action is to focus on getting these prototype translations correct. Perhaps you could consider doing that in the context of a separate standalone test project to avoid the complexity of the full application.

    If you want further help from Stack Overflow I think you will need to supply the VB6 function declarations and your attempted translations, but I think that would be the subject of new question(s).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a python extension module that needs to link with a third-party
I'm writing a module and want to have a unified exception hierarchy for the
I am writing a addressbook module for my software right now. I have the
I'm writing an Account module which should take care of everything about accounts: registration,
I am writing module which allows to quick add users only by providing First
I am having a hard time in manipulating strings while writing module for linux.
I have a third-party Python script (foo.py) in a folder that is in my
I'm writing a module which serializes others and I've got everything working only I'm
I'm writing a utility module for easy handling of data text files. I have
In the context of organic groups, I am writing a module which will stop

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.