Without getting into specifics, say I need to make use of a non-standard calling convention from C code. Functions that use this convention may return multiple values on the stack. It would be simple to put each function in a wrapper that uses inline assembly to make the call, sending output via pointer parameters given to the wrapper. Unfortunately, this solution doesn’t generalise well, and I need something that works in the general case. Should I just give up and use macros to encapsulate wrapping, or is there a more general way to write, say, a variadic invoke function that handles the dirty work of managing the stack?
Without getting into specifics, say I need to make use of a non-standard calling
Share
Whichever approach you choose, you’ll need to write the wrapper in assembly. There is no way to fiddle with the stack from C. I do like your idea of writing a single
invokewrapper (in asm) that does all the dirty work, and then wrapping that with C.