FFI Callback

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

FFI Callback

Nicolas Cellier
Hi all, Marcel,
I've just spent a few hours on fixing my own bug in HDF5 FFI callbacks.

That's expected, writing the callback is currently like writing assembler!
We must know:
- where we should pick argument depending on its type and rank
  is it serialized in the int registers array, float registers array or on stack?
- in which order are those arrays passed in? (this may vary with arch)
  and how many arguments do I need to deserialize my specific signature?
  just intRegs, or stackp, or floatRegs?
- at which offset should we pick each parameter?
- what if it is a struct passed by value?
- how a signedLongLong is passed on 32bits ABIs?

Beside, we support 4 different ABI and several calling conventions! Ouch!

Since I'm normally bad like most of us for this task (supernatural powers apart), we definitely need to assist the poor humans and have those wrapper auto-generated!

My 2¢, thanks in advance for generously putting the missing 999,999.98$.