• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using C++ classes with Objective C code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Using C++ classes with Objective C code (From: John Nairn <email@hidden>)

  • Prev by Date: TableView drag&drop entries
  • Next by Date: Re: Loading a TTF font
  • Previous by thread: Using C++ classes with Objective C code
  • Next by thread: Re: Using C++ classes with Objective C code
  • Index(es):
    • Date
    • Thread