My company provides a third-party DLL group that provides them with API functions that they can use to connect to our application. The DLL was written in VC9, and the API functions use the default VC calling convention (__cdecl). A third party has built their application around this interface.
Now I am tasked with writing an updated version of the DLL. We want the DLL to have the same interface as the old one, so they can be used interchangeably. Unfortunately, our development environment is CodeGear RAD Studio 2007, so I have to write a DLL using this.
The best solution would be to make both old and new DLL files export their functions as __stdcall. Then the third-party application can be re-associated with the expected __stdcall functions and everyone will be happy. Unfortunately, for various reasons, this is unlikely to happen.
Alternatively, I can declare functions in my DLL as __cdecl. A third party expects a __cdecl function, so this would be a good solution. Unfortunately, CodeGear insists on adding an underscore ('_') to the __cdecl function name. This means that a third-party application will have to conditionally call MyApiFunction(...)or _MyApiFunction(...), depending on the DLL used.
So my question is: how can I export API functions from my new DLL so that they are __cdecl and have no underscore ('_') prefix?
source
share