how to use an extern function in dynamic library

18 Views Asked by At

I use Xcode build a dynamic library:

In test.h

extern void extern_func(void);
@interface test : NSObject
@end

In test.m

@implementation test
+ (void)load {
   extern_func();
}
@end

When compiling, the compiler complains:Undefined symbols for architecture x86_64: _extern_func

I tried adding the parameter -fPIC to other c flags, but it doesn't seem to have any effect.

0

There are 0 best solutions below