C - DLL needs to be __stdcall and import __cdecl lib
Question
I'm compiling a DLL which needs to use portaudio. It uses all sorts of windows libraries for sockets and such too, but the linker wouldn't recognize the portaudio library. Then I remembered portaudio uses __cdcel instead of __stdcall. Normally I would just use __cdcel and be done with it, but the DLL I'm compiling needs to use __stdcall because I'm going to use it with Visual Basic.
And if this project sounds like a bit of a kludge to you, it is.
Solution
Stupid me! All I have to do is use __cdcel and declare the exported functions as __stdcall!
OTHER TIPS
I presume you need to use __cdecl because portaudio will call some of your functions? Then create an internal function declared __cdecl, pass this function to portaudio, and provide an exported function (declared __stdcall) that calls your internal function.
But I am kind of guessing at what you are trying to do, you should provide more info.