I'm attempting to write my first custom Cocoa Framework and I want to expose a simple C function from the framework that wraps up a bunch of functionality, much like NSApplicationMain does. When I simply imported the files directly from within the project, everything went fine, the project built and my C function was called correctly.
Now I have a new Cocoa Framework project which contains the files, I cant build my program because I get "Symbols not found" error messages, specifically for my C function.
I've tried prefixing the function definition in the header file with extern, but still nothing.
Can anyone give me a heads up? How can I expose standard C functions via custom Cocoa Framework?
Rough idea of what I'm doing:
My Program that uses my custom framework:
#import <BDWebApplicationFramework/BDWebApplication.h>
int main (int argc, const char * argv[]) {
return BDWebApplicationMain(argc, (const char **)argv);
}
My framework header: BDWebApplication.h
#import <Foundation/Foundation.h>
@interface BDWebApplication : NSObject {
NSString *name;
}
@property (readwrite, copy) NSString *name;
@end
extern int BDWebApplicationMain(int argc, const char * argv[]);
My framework file: BDWebApplication.m
#import "BDWebApplication.h"
@implementation BDWebApplication
@synthesize name;
- (id)init
{
[super init];
name = @"New name";
return self;
}
- (void)dealloc
{
[name release];
[super dealloc];
}
@end
int BDWebApplicationMain(int argc, const char * argv[])
{
// Do some Obj-c stuff here
}