Delphi XE6 link C code in iOS Delphi XE6 link C code in iOS ios ios

Delphi XE6 link C code in iOS


The code looks proper and your calling convention handling is, to my eyes, perfectly correct.

I think you may have ran into a possible/rumoured bug in Apple's ARM clang where calling a static function (which may happen behind the scenes e.g. for type conversion) from a static function may cause stack corruption. You're not doing so directly, but extern functions may be implemented through a stub which calls an anonymous static function containing the implementation.

You can try having your extern function be a wrapper which only calls a non-static implementation function instead.