Sunday, 15 March 2015

gcc - Fastcall name decoration in Windows does not port easily -



gcc - Fastcall name decoration in Windows does not port easily -

i'm using mingw in windows compile code in c , assembly, several functions in have fastcall calling convention (as microsoft defines it). if utilize __fastcall in declaration, mingw windows , name decorates:

an @ sign (@) prefixed names; @ sign followed number of bytes (in decimal) in parameter list suffixed names

this works fine. have labels in assembly in form:

.global @myfunction@4 @myfunction@4: ....code....

but proves big problem when port linux (x86, 32 bit). gcc not __fastcall (or __cdecl matter) , not @ in labels @ all. i'm not sure how can unify 2 issues - either gcc in linux @ or mingw in windows not add together @.

also: can utilize __attribute__(__cdecl__) in place of __cdecl i'm puzzled goes. assumed before function name see people putting after declaration , before semicolon. can either?

related answer: adding leading underscores assembly symbols gcc on win32?

name decoration appears mutual theme when porting between operating systems, platforms , processors on same platform (ia32 ia64 illustration loses underscore).

the way solved remove @ decoration function used didn't need export them other testing. other functions redefined function _function using macros (that's macro assemblers after all).

in case renamed assembly code .s .sx (windows platform) , uses gcc preprocessor check _win32 , redefine export global symbols have leading underscores. same calls _calloc , _free.

gcc mingw fastcall

No comments:

Post a Comment