I have a library which uses an inline C function, and is compiling just fine. When another library references that library, it still compiles fine. But if an actual app refe
just add FOUNDATION_EXPORT
to function on the header (.h). Remember import Foundation/Foundation.h (OS X) or UIKit/UIKit.h (ios).
Example:
//.h
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT inline NSString * myInlineFunction(void);
You should add the static specifier to your inline function definition if the function is intended for use only in the same translation unit (internal linkage),
static inline int add(int x, int y) {return x+y;}
int s = add(1, 2);
If you omit static in the example above (in Debug configuration, where no optimization is performed and no inlining is carried out), the linker will exit with error complaining _add is referenced but Symbol(s) not found.
In C99, an inline function declaration without any storage specifier will not generate an actual callable function body so the linker gives an error when it needs one.
If your inline function may be used by other modules, it's more complicated. A common practice is to include the inline function definition (without extern) in the header file and include exactly one prototype declaration with extern in exactly one module.
A good article explaining inline functions in C99: http://www.drdobbs.com/184401540