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

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


  • Subject: Question on guidelines of integrating C++ calls inside an Obj C class
  • From: John Draper <email@hidden>
  • Date: Tue, 02 Aug 2005 23:23:55 -0700

Hi,

Xcuse me got posting this twice,  but last week I got no indication this
message got posted - because I urgently need help, I'm posting this
again.

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


  • Follow-Ups:
    • Re: Question on guidelines of integrating C++ calls inside an Obj C class
      • From: Justin Kolb <email@hidden>
  • Prev by Date: Mixing C++ with Objective C
  • Next by Date: Re: Crash after weeks of doing nothing to my code
  • Previous by thread: Mixing C++ with Objective C
  • Next by thread: Re: Question on guidelines of integrating C++ calls inside an Obj C class
  • Index(es):
    • Date
    • Thread