How to implement an IMP function that returns a large struct type determined at run-time?
Solution 1:
It seems that the Apple engineer is right: the only to way to go is assembly code. Here are some usefull pointers to getting started:
- From the Objective-C runtime code: The i386 and x86_64 hand-crafted messenger assmbly stubs for the various messaging methods.
- An SO answer that provides an overview of the dispatching.
- A in-depth review of the dispatching mecanism with a line-by-line analysis of the assembly code
Hope it helps.