function arguments are passed in registers

Tom St Denis tstdenis@ellipticsemi.com
Thu Jan 3 12:31:00 GMT 2008


Zheng Da wrote:
> Suppose I have two libraries, A and B.
> In library A, there is function a() whose arguments are passed in registers.
> In library B, there is b() whose arguments are passed in the stack.
> Now I have to use a() and b() in my program.
> But how do I tell GCC that they use different ways to pass the
> arguments and which is the right way.
>   
This is why a common ABI exists.  The only "sane" way to accomplish this 
with GCC is to write a "thunking" [iirc that's the term] layer in which 
you pass the parameters in a different convention.

How did you end up with this mess anyways?  Most assembler routines  
that interface with C are written to use the ABI so they're drop in.

Tom



More information about the Gcc-help mailing list