I had to implement a C function in an Objective-C class that normally would get called with int main (in it’s own file). Since I’m unfamiliar with splicing code I need to know how to have it called upon in either the awakefromnib or applicationDidFinishLaunching from within the Cocoa section. Or if there’s a much better way to do this I’m listening.
Here’s an example without getting too technical:
// Cocoa Imports
#import "AppDelegate.h"
...
// C Inlcudes
#include <stdio.h>
// (int main had to change to something else obviously)
int dos () {
printf ("I'm a C program\n");
}
// (back to cocoa)
@implementation AppDelegate
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
//[This is where I need my C function above to execute]
It’s called just the same as you would from C and you can call any C function you like: