Re: Compile errors
Re: Compile errors
- Subject: Re: Compile errors
- From: Fritz Anderson <email@hidden>
- Date: Fri, 27 Feb 2009 10:16:00 -0600
On 26 Feb 2009, at 10:19 PM, Barry Fawthrop wrote:
To Greg Thank for the input
I have asn1_encode.mm
and AppController.m
I changed this to AppController.mm and all worked fine ???
This is a result of the C++ name mangling Greg mentioned. C++ will
take a simple-looking function name and translate (mangle) it into
something more complex, encoding return and parameter types, for the
purpose of storing the object code to be linked. C just puts an
underscore in front of the function's name.
Changing the suffix from .m to .mm changed the semantics of function
declarations so that function declarations point at the complex object-
code name instead of the simple one. As the functions in question were
defined in C++ (and not guarded by the 'extern "C"' declaration that
suppresses mangling), they couldn't be found by the simple name.
But .m files are built on the simpler C model, which pointed them at
the simple name.
Look up "C++ mangling" to get a better feel; it's an issue that will
come up repeatedly.
– F
--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- <http://x3u.manoverboard.org/
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden