Re: Using C++ classes with Objective C code
Re: Using C++ classes with Objective C code
- Subject: Re: Using C++ classes with Objective C code
- From: "Alastair J.Houghton" <email@hidden>
- Date: Fri, 10 Oct 2003 17:49:11 +0100
On Friday, October 10, 2003, at 05:24 pm, John Nairn wrote:
File DateFunctions.mm (the interface file)
#import "DateFunctions.m"
#include "FullDate.h"
NSString *GetDateYear(NSString *dateStr)
{
FullDate fd;
fd.SetFromString([dateStr lossyCString]);
return [NSString stringWithCString:fd.YearString()];
}
Because .mm files are based on C++, you need to write
extern "C" NSString *GetDateYear(NSString *dateStr)
otherwise the name gets mangled and the linker won't be able to find
the symbol.
Kind regards,
Alastair.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.