[Insight-developers] Re: Are preimport() and postimport() really useful in itkbase.py ?

Gaetan Lehmann gaetan.lehmann at jouy.inra.fr
Sun Jan 15 12:58:53 EST 2006


On Sunday 15 January 2006 17:00, Brad King wrote:
> Gaetan Lehmann wrote:
> > I don't really understand the preimport() and postimport() function in
> > itkbase.py. I seems that we can load the modules without them without any
> > problem.
> > Are they really useful ?
>
> On what platform are you succeeding without them?

I have done that on a linux 64 bits with gcc 4.0.2

> Windows will work 
> fine but posix platforms require them.  The ITK wrapper code must be
> loaded with RTLD_GLOBAL set in the dl flags.  By default python loads
> modules without this flag to keep them isolated from one another.  Since
> the wrapper modules share code (such as the virtual tables of the higher
> classes), their symbols must be integrated at runtime.
>
> Although the modules appear to load successfully they may not run
> properly.  If an object is created in one module and passed through
> python to another then a dynamic_cast down the hierarchy may fail
> depending on the compiler's implementation of RTTI.  In GCC 3.x and
> above it will almost certainly fail.  That is the reason preimport and
> postimport were created in the first place.
>

Ok, you're right. The module are imported, but objects can't be passed from 
one module to one other.
Thanks for your clear explanations :-)

Gaetan

> The functions also allow the libraries to be loaded without setting
> LD_LIBRARY_PATH to point at their location.
>
> -Brad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.itk.org/mailman/private/insight-developers/attachments/20060115/492a5679/attachment.pgp


More information about the Insight-developers mailing list