It works for me, if I just use extern
instead of extern inline
when defining the function.
Example: inlib.h
extern int foo(int i);
extern int callsfoo(int i);
inlib.m:
#import "inlib.h"
#import "stdio.h"
extern int foo(int i) { printf("Foo: i = %d\n", i); }
extern int callsfoo(int i) {
printf("Callsfoo:\n");
foo(i);
}
Library created with:
gcc -ObjC -c inlib.m -o inlib.o
ar -q lib.a inlib.o
caller.m:
#import "inlib.h"
#import "stdio.h"
int main(int argc, char** argv) {
printf("Calling foo directly.\n");
foo(1);
printf("Calling foo via callsfoo.\n");
callsfoo(2);
return 0;
}
Compiled with: gcc -ObjC -o caller caller.m lib.a -lobjc
Run with: ./caller
Returns:
Calling foo directly.
Foo: i = 1
Calling foo via callsfoo.
Callsfoo:
Foo: i = 2