Op 30-May-14 1:02, (e-mail address removed) schreef:
Not sure if this is OT or not, but I am getting unresolved externals
which I suspect to be from addressing and calling convention
differences.
It might be just a matter of a missing extern "C" declaration around the
C function declarations. To support function overloading most, if not
all, C++ compilers mangle the function names. When calling a C function
from C++ code, the C++ compiler has to know that it shouldn't mangle the
names, otherwise the linker would look for a mangled name in the C
library which doesn't exist, which in turn would lead to a "unresolved
external" error.
I am not really sure how linkage works when a library is compiled
with cdecl vs stdcall and is attempted to be linked into an
executable that uses the other.
I'm not entirely sure, but I don't think the calling convention affects
linking. I.e. if the calling side is compiled with the cdecl calling
convention whereas the library implementing the function uses the
stdcall calling convention I would expect that the linker happily links
those. Not that that is a good thing as it would result in obscure
behavior when actually running the code.
Is there a tool somewhere that can be used to examine addressing and
calling convention for static libs?
Since your are talking about stdcall and cdecl calling conventions
(which is not topical for this newsgroup), I assume you are using the
Microsoft development environment. In that case the dumpbin tool might
give you a clue what is going on.