This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: function arguments are passed in registers


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]