How can I get the calling convention at runtime using type library whether using stdcall, cdecl, winapi or any other?
If a typelibrary is involved, you're using COM. COM always uses the same calling convention (on a given OS), so it isn't encoded into the type library. In the headers it shows up as STDMETHOD
(or something like that -- I'm too lazy to check the exact spelling at the moment), but if memory serves it's basically equivalent to __cdecl
. If memory serves, there's also an _STDMETHOD
(or, again, something similar) that lets you specify a return type other than HRESULT
.