Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa with carbon calls




On Dec 21, 2005, at 9:22 AM, Livio wrote:

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.

-eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/macnetworkprog/email@hidden

This email sent to email@hidden
References: 
 >Cocoa with carbon calls (From: Livio <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.