Boost logo

Boost Users :

Subject: Re: [Boost-users] [Boost.serialization] unexpected bad_cast exception while deserializing some arbitrary instances (e.g.: ar & data) ...
From: Francois Mauger (mauger_at_[hidden])
Date: 2009-05-28 10:50:07


Hi Troy
Thanks a lot for these comments! I'll have a look.
Best regards and happy neutrinos!
frc (forever searching for neutrinoless double beta...)

--
 >>troy d. straszheim a écrit :
> François Mauger wrote:
>> Hi Troy,
>>
>>> You could try adding this to the top of your script:
>>>
>>>       import dl
>>>       import sys
>>>       flags = sys.getdlopenflags()
>>>       sys.setdlopenflags(flags | dl.RTLD_GLOBAL)
>>>
>>
>> Great! It works (at least no problem appeared after several trial)!
>> Thank you very much. I was so desesperate!
>> It seems also that I should use this 'trick' within my former
>> work: it has probably worked for monthes only by chance!
> 
> We (IceCube) use this combination of serialization and python bindings 
> on a large
> scale on linux/osx/fbsd with good results.  I wouldn't be too afraid.
> 
>> Now I got a solution, may I dare ask you an explanation
>> about this issue?
>> I'm rather unskilled with this 'dl' stuff. What I don't understand
>> is why my code was working in some case and not in another one, despite
>> the fact that imported wrapper modules were the same.
>> Does it have to do with some unpredictable dynamic loading
>> of symbols depending of the Python running context? Do you think this
>> issue would appear also under Darwin (the other target OS for my libs)?
> 
> You can look at the what the flags RTLD_GLOBAL and RTLD_LOCAL do in a
> call to dlopen() (manpage).  It is worth writing some test cases and 
> really learning what is happening.  By default a python 'import' uses
> RTLD_LOCAL (use strace and see for yourself);  the voodoo above sets the
> default to RTLD_GLOBAL, as you can probably guess.  There is also a
> paper called "how to write shared libraries" by Ulrich Drepper with lots
> of good background information in it.
> 
> Another thing to play with: force an RTLD_GLOBAL load of the wrapped 
> shared library by calling dlopen("libwrappedlib.so", RTLD_NOW | 
> RTLD_GLOBAL) inside the BOOST_PYTHON_MODULE(wrappedlib) { ... } function.
> 
> -t
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
> 
-- 
François Mauger
Département de Physique - Université de Caen Basse-Normandie
courriel/e-mail: mauger_at_[hidden]
tél./phone: 02 31 45 25 12 / (+33) 2 31 45 25 12
fax:        02 31 45 25 49 / (+33) 2 31 45 25 49
Adresse/address:
   Laboratoire de Physique Corpusculaire de Caen (UMR 6534)
   ENSICAEN
   6, Boulevard du Marechal Juin
   14050 CAEN Cedex
   FRANCE

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net