Lazarus

Miscellaneous => Other => Topic started by: guest65405 on March 29, 2020, 05:24:57 am

Title: How to check if a given static library use STDCALL or CDECL?
Post by: guest65405 on March 29, 2020, 05:24:57 am
I was given a static library compiled by MinGW64, whose has an extension .a but not the regular .lib I'm familiar with. No further information was provided other than the API document. How could I check if it use STDCALL or CDECL calling convention?
Title: Re: How to check if a given static library use STDCALL or CDECL?
Post by: Leledumbo on March 29, 2020, 05:40:11 am
I was given a static library compiled by MinGW64, whose has an extension .a but not the regular .lib I'm familiar with. No further information was provided other than the API document. How could I check if it use STDCALL or CDECL calling convention?
Use objdump -t <that .a>. If the symbols have @<some integer> suffix, it's stdcall. Otherwise, assume cdecl (if there's no other possibilities).
Reference: https://en.wikipedia.org/wiki/Name_mangling
Title: Re: How to check if a given static library use STDCALL or CDECL?
Post by: guest65405 on March 29, 2020, 06:50:38 am
I was given a static library compiled by MinGW64, whose has an extension .a but not the regular .lib I'm familiar with. No further information was provided other than the API document. How could I check if it use STDCALL or CDECL calling convention?
Use objdump -t <that .a>. If the symbols have @<some integer> suffix, it's stdcall. Otherwise, assume cdecl (if there's no other possibilities).
Reference: https://en.wikipedia.org/wiki/Name_mangling
As I didn't see any @ I think it should be CDECL. Thanks.
Title: Re: How to check if a given static library use STDCALL or CDECL?
Post by: PascalDragon on March 29, 2020, 01:03:40 pm
I was given a static library compiled by MinGW64, whose has an extension .a but not the regular .lib I'm familiar with. No further information was provided other than the API document. How could I check if it use STDCALL or CDECL calling convention?

If it's a 64-bit library then it doesn't matter as on x86_64 there is no difference between calling conventions (they only differ by platform, namely Win64 vs. everyone else).
Title: Re: How to check if a given static library use STDCALL or CDECL?
Post by: marcov on March 29, 2020, 04:39:25 pm
If it's a 64-bit library then it doesn't matter as on x86_64 there is no difference between calling conventions (they only differ by platform, namely Win64 vs. everyone else).

Well, vectorcall is different.
Title: Re: How to check if a given static library use STDCALL or CDECL?
Post by: PascalDragon on March 30, 2020, 09:38:51 am
If it's a 64-bit library then it doesn't matter as on x86_64 there is no difference between calling conventions (they only differ by platform, namely Win64 vs. everyone else).

Well, vectorcall is different.

Okay, yes, point taken, but those are rather rare.  :-[
TinyPortal © 2005-2018