Re: RTTI and exceptions between plugins (solution)
Re: RTTI and exceptions between plugins (solution)
- Subject: Re: RTTI and exceptions between plugins (solution)
- From: Steve Baxter <email@hidden>
- Date: Wed, 8 Feb 2006 21:57:10 +0000
Hi Tom,
If your exceptions are defined in a framework that both plugins link
to then you are probably OK. You need to make sure that the
exception is not completely inline (i.e. at least some of it is
defined in a .cpp file in the common framework).
The problem in my case was a messaging system that used RTTI to
distinguish messages (in much the same way as exceptions work). If
plugin A sends a message X to plugin B, and message X was completely
inline (which is common as they are trivial classes), A and B will
each have their own copy of X. When plugin B gets the message and uses:
if( typeid theMessage) == typeid(X) )
{
... do something
}
The comparison will fail, as even though typeid theMessage).name() ==
typeid(X).name(), &typeid(theMessage) != &typeid(X).
The same could potentially happen with exceptions.
This problem on the whole will not happen with applications that have
public plugin interfaces (e.g. Photoshop). Here, the interface tends
to be small and well defined, and the innards of the plugins are
largely private. In our case we use plugins differently - they
integrate as if they are a full part of the program, largely the user
doesn't know about the plugins, they are really just a way for us to
divide up the functionality into easily managed chunks (which can be
distributed across the team).
Cheers,
Steve.
On 8 Feb 2006, at 21:14, Thomas Engelmeier wrote:
Hi,
You only need to use RTLD_GLOBAL if you want RTTI and exceptions
to work across the plugins. In your case you should be OK with
the current behaviour - by default symbols in loaded dylibs are
private.
Unfortunately this is RTTI _OR_ exceptions, and exceptions without
RTTI are pretty useless.
Regards,
Tom_E
Steve Baxter
Software Development Manager
Improvision
+44-2476-692229
_______________________________________________
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