Functions that are not members in Objective-C

I want to write a separate function in Objective-C; so it's essentially a C-style function, with an Objective-C call. For instance:

NSString* someFunc()
{
 NSString* str = [[NSString alloc] init];

 return str;
}

I declare the function in the header file and define the .m file in it. However, the function does not seem to compile as the linker complains about the missing character. I thought that maybe I should put it in a C file, but then, of course, he spat on me for writing Objective-C bullshit in BASI ... C.

What to do?

+5
source share
1 answer

. .m, .mm(++/ Objective-C), , , ++- .

#ifdef __cplusplus
extern "C" {
#endif

// Declaration

#ifdef __cplusplus
}
#endif

.

+3

All Articles