Short version: Does anyone know why there'd be problems using C functions declared static from within an Objective-C class that's part of a statically-linked custom framework on iOS? I get "Bad system call: 12" crashes unless I remove the 'static' keyword from the function in question.
Long version:
I'm building a static framework for iOS, which I'm also building an iOS app around. I've had a bugger of a day trying to figure out why the app crashes when built against the framework, and yet works perfectly when built against a static library version of the framework. Further messing around reveals that the version built against the framework runs perfectly from Xcode (including when deployed as a Release build), yet crashes when installed from an IPA.
When the crash happens, the following appears in the console:
Mar 22 19:21:39 unknown ReportCrash[1784] <Notice>: Formulating crash report for process AB Receiver[1782]
Mar 22 19:21:39 unknown com.apple.launchd[1] <Warning>: (UIKitApplication:com.atastypixel.AB-Receiver[0x3a1e]) Job appears to have crashed: Bad system call: 12
Mar 22 19:21:39 unknown SpringBoard[52] <Warning>: Application 'AB Receiver' exited abnormally with signal 12: Bad system call: 12
Interestingly, the crash log that's written out has symbols at the last few stack trace positions that aren't being symbolicated.
After a bit of NSLog-based debugging, I've discovered the crash is happening just as a static C function is called from one of the Objc classes within the framework:
static void refreshMixingGraph(ABAudioReceiver *THIS) {
...
}
...
refreshMixingGraph(self); <- Crashes here
If I get rid of the 'static' keyword, miraculously, the crash stops happening.
Now I can live without the static keyword, but... What the heck is going on!
Anyone know why I'd be seeing this freaky-deaky stuff?
Cheers!
Michael