Reputation: 489
I have an already built static library on Windows VS2012 (.lib), compiled with the stdcall convention. When I say "already built", I mean unfortunatedly I cannot rebuild it with the calling convention of my choice.
Is it possible to call a function from this library from a code compiled with cdecl convention ? Or at least do some kind of wrapper ?
I am not sure it is possible (after browsing SO, I am in fact almost convinced this is totally impossible) but some guy here vaguely mentioned there might be a kludge. Any idea ?
Upvotes: 1
Views: 1818
Reputation: 2466
In the header for your static library, declare the imported functions as extern <return_type> __stdcall
. See more about calling convention attributes on MSDN: https://msdn.microsoft.com/en-us/library/zxk0tw93.aspx
Upvotes: 2