Author Topic: Passing structure into function in c  (Read 16671 times)

0 Members and 1 Guest are viewing this topic.

Offline Renate

  • Super Contributor
  • ***
  • Posts: 1812
  • Country: de
    • Renate's Android Page
Re: Passing structure into function in c
« Reply #25 on: February 16, 2022, 07:27:42 pm »
I'll just say that it's all a can of worms.
Are you compiling caller and callee on the same box? Congratulations, it will work and you don't need to know the details.
Are you calling a closed source routine? Then you have to know the game rules.

I just got through interfacing with some stuff where you didn't know what they were doing.
Since it was "Pascal" convention (callee cleans up) then you just need to call with a fistful of args and see how the stack is when the callee returns.
One of the functions apparently used one more arg than I was thinking of, ergo, it was a "hidden arg" for a pointer to the return value.
The return value was an array of two floats.
But it could have been delivered in two FPU regs or whatever.
You don't know until you try.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->