• 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: Question on guidelines of integrating C++ calls inside an Obj C class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on guidelines of integrating C++ calls inside an Obj C class


  • Subject: Re: Question on guidelines of integrating C++ calls inside an Obj C class
  • From: Óscar Morales Vivó <email@hidden>
  • Date: Thu, 28 Jul 2005 15:30:44 -0400

Search the documentation for "Objective-C++" and you should find what you're looking for.

I think also there were some improvements to Obj-C++ in Tiger (like constructors and destructors of C++ objects in Obj-C instances being called when they should. Before you had to use pointers and create/ delete them manually in init/dealloc).

Hope that helps.

On Jul 28, 2005, at 00:01 , John Draper wrote:

Hi,

I'm making calls to a UNIX library written in C++. In specific, it is the
'resipricate" library written in C++.


I want to use these libraries inside of an Objective C class, in particular
a "Controller" class. The controller class is obviousy going to have to
reference the C++ classes, and instances of the C++ classes need to
be defined as Objective C classes. Is this possible? Or do I always have
to use pointers to the C++ classes when referencing them and use "new"
to Instantiate them?


Another thing I'm not sure of is doing this...

In C++

message.header(h_To).displayName() = "Speedy Shannon";

The "=" is overridden... so, is the string "Speedy Shannon" really a string?

I want to basically convert an NSString which would come from a GUI,
and pass that into the C++ function you see above...

Would this work?

NSString *str = @"Speedy Shannon";
char *cstr = alloc([str length] + 1); // alloc space for C string
[str getCString:cstr]; // get it from the NSString
message.header(h_To).displayName() = cstr; // <--- is this the same as the one above?


The "operator overload" code '=' is defined as such

SipMessage&
SipMessage::operator=(const SipMessage& rhs)
{
    // some code....
}

John

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Question on guidelines of integrating C++ calls inside an Obj C class (From: John Draper <email@hidden>)

  • Prev by Date: Opening and NSCoding an NSObject Subclass
  • Next by Date: Re: Newbie Help understanding Core Data
  • Previous by thread: Question on guidelines of integrating C++ calls inside an Obj C class
  • Next by thread: [Core Data - Newbie] Creating Reports
  • Index(es):
    • Date
    • Thread