I'm working at a cocoa application (Mac OS X.3.6) and need to make
carbon calls.
In my project (XCode 1.0) I've created 2 carbon files (extensions
".h" and ".cpp") with all the carbon procedures.
When I build the application everything seems to work, but at
runtime a "ZeroLink: unknown symbol ..." is returned.
Can anybody tell me what happens and what I should do?
You probably need to surround the function prototypes in your .h file
with
#ifdef __cplusplus
extern "C" {
#endif
and
#ifdef __cplusplus
}
#endif
so that the C++ compiler won't name-mangle the functions in the .cpp
file.
Also, note that you don't have to put calls to Carbon APIs into a
separate source file; you can make those calls from your Objective-C
source file too. You can even use C++ in your Objective-C source file
if you end the file with .mm instead of .m.