This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Questions about __cxa_throw and type_info


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]