• 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
C++ RTTI/dynamic_cast across share module boundaries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

C++ RTTI/dynamic_cast across share module boundaries


  • Subject: C++ RTTI/dynamic_cast across share module boundaries
  • From: Mads Paulin <email@hidden>
  • Date: Tue, 19 Jan 2010 17:27:35 +0100

Hi,

I have hit what seems to be a very common problem when creating a plugin-based application utilizing the C++ dynamic_casting operator to down-cast a pointer in a dynamically loaded module.

As described in numerous places (e.g. here: http://lists.apple.com/archives/xcode-users/2006/Mar/msg00119.html) many other developers have experienced this since GCC compares type_info's by address instead of by comparing the name() strings, a pointer of class A in the main application does not dynamic_cast to a class A pointer in a loaded module.

I have been searching for a solution to this problem for a couple of days and tried out several proposed solutions but with no luck.

To sum up, this is what I've got:

1) A main application with a hierachy of C++ polymorphic classes. The application stores instances of these classes in a tree of base-class pointers.
2) A number of Controller/GUI plugins (NSBundles) each containing an Objective-C controller for a given main application polymorphics child class and a corresponding gui to set the properties of this represented object.

-Each controller object performs a dynamic_cast of the passed polymorphic baseclass pointer down to the object type that it can control. However due to the above problem, this dynamic_cast fails.


So - is there anyone on this list that has been able to successfuly use C++ RTTI across module boundaries and if so, what combination of xcode/GCC flags and dlopen tricks etc. was used ?

Kind regards,
Mads Paulin
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: C++ RTTI/dynamic_cast across share module boundaries
      • From: Marshall Clow <email@hidden>
  • Prev by Date: Re: Why does IB insist on putting NSTextView in an NSScrollView
  • Next by Date: Re: C++ RTTI/dynamic_cast across share module boundaries
  • Previous by thread: Re: including xibs from another project
  • Next by thread: Re: C++ RTTI/dynamic_cast across share module boundaries
  • Index(es):
    • Date
    • Thread