Questions about __cxa_throw and type_info
Joe Buck
Joe.Buck@synopsys.COM
Fri Apr 6 18:41:00 GMT 2007
On Fri, Apr 06, 2007 at 10:29:27AM -0700, Brian Ellis wrote:
> I am in the proof of concepts stage of developing an extension language
> intended to interoperate natively with c++. The chief goal being the
> ability to derive new types at runtime, override virtuals, and have
> instances of these new types passed around to the engine of the extended
> application.
It's possible to do this entirely within the language; we did this 15
years ago in the Ptolemy project: http://ptolemy.eecs.berkeley.edu
(the C++ version is now called Ptolemy Classic as they went and re-did
the thing in Java after I left).
The basic approach is that objects know how to clone themselves. Then
you can add new classes that derive from an existing, preloaded class
that has a clone member function. The new code to be loaded in has
a constructor that has the side effect of registering a new object on
the known-classes list, then the application can create application graphs
consisting both of predefined classes and new classes loaded at runtime.
I don't understand why you are messing around with __cxa_throw and
type_id. Our implementation predated the introduction of RTTI into
the language so we needed to define conventions for object identification
(for example, return the class name as a string). But we managed to
do everything without messing with details like this, and still got the
thing to run on about six different C++ compilers.
More information about the Libstdc++
mailing list