• 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: cocoa app using external c++ code
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: cocoa app using external c++ code


  • Subject: Re: cocoa app using external c++ code
  • From: Paul Forgey <email@hidden>
  • Date: Sat, 1 Apr 2006 12:23:01 -0800

All of these classes work and are heavily used in loads of other programs that aren't objective c.

Anyway, I did some more poking and found out that despite what the XCode UI was showing me, the program was using ZeroLink even though I thought I turned it off. After rectifying that situation, the problem went away.

Here's how to reproduce the problem:

shared library built normally
 exports a simple c++ class with a vtable (virtual d'tor is enough):

 class Foo
 {
    public:
      Foo ();
      virtual ~Foo ();
 };

host objective c++ application ZeroLink'd
Foo *foo = new Foo (); // note WE call new, not the library
delete foo; // underlying free() call from operator delete doesn't recognize heap address


On Apr 1, 2006, at 8:10 AM, John Stiles wrote:

What does the destructor of Otherclass do?


Paul Forgey wrote:
I have a cocoa app written using objc++ using external c++ code. Any external classes allocated via new crash the heap if I delete them. If I enable Guard Malloc I get this message:

GuardMalloc[Administration Console-1883]: Tried to free pointer at 0xb161d6cc which is not currently a pointer to a malloc buffer.
GuardMalloc[Administration Console-1883]: Explicitly trapping into debugger!!!


Which pretty much agrees with what malloc_printf complains about with it turned off. I know for a fact I am not disturbing the state of the heap, as I can cause this to happen first thing in main before running any actual code:

// main.mm

int main (int argc, char *argv[])
{
  Otherclass *x = new Otherclass ();
  delete x; // CRASH
  ..
}

What's going on?? I can't find any compiler options XCode is setting that would disturb alignment or anything. In fact my working C++ command line programs all see the same sizes and layouts the cocoa app does.


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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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: 
 >Re: cocoa app using external c++ code (From: John Stiles <email@hidden>)

  • Prev by Date: Re: cocoa app using external c++ code
  • Next by Date: Deletes Object on Remove option
  • Previous by thread: Re: cocoa app using external c++ code
  • Next by thread: Re: vImage crop?
  • Index(es):
    • Date
    • Thread