I'm using mingw in Windows to compile code in C and assembly, several functions in which have the fastcall calling convention (as Microsoft defines it). If I use __fastcall in the declaration, mingw does what Windows does and name decorates:
An at sign (@) is prefixed to names; an at sign followed by the number of bytes (in decimal) in the parameter list is suffixed to names
This works fine. I have labels in assembly in the form:
.global @myfunction@4
@myfunction@4:
....code....
But this proves a big problem when I port to Linux (x86, 32 bit). Gcc suddenly does not like __fastcall (or __cdecl for that matter) and does not like @ in labels at all. I'm not sure how I can unify the two issues - either get gcc in Linux to like @ or get mingw in Windows to not add the @.
Also: I can use __attribute__(__cdecl__)
in place of __cdecl
but I'm puzzled as to where it goes. I assumed before the function name itself but I see people putting it after the declaration and before the semicolon. Can I do either?