I'm working on building a plug-in for Adobe Illustrator. Adobe provides a C-based SDK (https://console.adobe.io/downloads) and some "wrapper" classes in C++.
I've generated bindings for all of this using bindgen. The wrapper classes are compiled into my project using cc crate. This all works well and gets linked nicely.
The problem I'm now running into is calling methods on the wrapper classes from my Rust code (C functions inside SDK work well). The methods are available and can be called, but the parameters don't get handed over correctly. Debugging the functionality revealed, that the parameters "vanish" once I cross the FFI border. Basically the pointer to the parameter value points into nirvana.
Looking into the registers shows:
rdiboth hold the correct address and the value is available there
rsiall hold the address wrongly used on the C side for the function parameter
So I assume the wrong calling convention is used here.
Any ideas on how to fix this?