Hello Philipe,
This was the output when I tried your suggestion:
root [0] .L boost_test.h++
Info in <TUnixSystem::ACLiC>: creating shared library
/media/usbdisk/Analysis/B_2_X_b_Dst/script/./boost_test_h.so
Fatal: sizeof(::OptimalCuts) == sizeof(::ROOT::Shadow::OptimalCuts)
violated at line 60 of
`/media/usbdisk/Analysis/B_2_X_b_Dst/script/./fileWwCCjn.cxx'
aborting
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
Attaching to program: /proc/25157/exe, process 25157
[Thread debugging using libthread_db enabled]
[New Thread -1224894784 (LWP 25157)]
0xffffe410 in __kernel_vsyscall ()
#1 0xb7093933 in waitpid () from /lib/tls/i686/cmov/libc.so.6
#2 0xb703d3c9 in strtold_l () from /lib/tls/i686/cmov/libc.so.6
#3 0xb71427dd in system () from /lib/tls/i686/cmov/libpthread.so.0
#4 0xb7b1e9d5 in TUnixSystem::Exec () from /opt/root/lib/libCore.so
#5 0xb7b264f9 in TUnixSystem::StackTrace () from
/opt/root/lib/libCore.so
#6 0xb7a793ab in DefaultErrorHandler () from /opt/root/lib/libCore.so
#7 0xb7a78e57 in ErrorHandler () from /opt/root/lib/libCore.so
#8 0xb7a79080 in Fatal () from /opt/root/lib/libCore.so
#9 0xb5df19a0 in ROOT::GenerateInitInstanceLocal () from
/media/usbdisk/Analysis/B_2_X_b_Dst/script/./boost_test_h.so
#10 0xb5df2117 in __static_initialization_and_destruction_0 ()
from /media/usbdisk/Analysis/B_2_X_b_Dst/script/./boost_test_h.so
#11 0xb5df24b5 in __do_global_ctors_aux () from
/media/usbdisk/Analysis/B_2_X_b_Dst/script/./boost_test_h.so
#12 0xb5df14d9 in _init () from
/media/usbdisk/Analysis/B_2_X_b_Dst/script/./boost_test_h.so
The file boost_test.h is
#include <TROOT.h>
#ifndef __CINT__
#include <boost/tuple/tuple.hpp>
#include <boost/tuple/tuple_comparison.hpp>
#include <boost/tuple/tuple_io.hpp>
#endif
class OptimalCuts{
public :
#ifndef __CINT__
boost::tuples::tuple<int, double> T;
#endif
};
Regards
Augusto
Philippe Canal escreveu:
> Hi, > > Just a general comment :) > > >> You could modify all the headers and source files for >> the Boost libraries you want to use to include the relevant CINT magic >> (ClassDef/ClassImp and LinkDef.h files) and generate all the >> dictionaries, and then load them up. >> > > ClassDef/ClassImp are no longer required to be able to store your object in > ROOT file. You _just_ need a dictionary for the class your want to > persist (and all the type of their data members). > > Now the hard part is that the CINT parser fails on the boost headers. > Your best option is usually to hide the boost header file from CINT > #ifndef __CINT__ > #include <boost/tuple/tuple.hpp> > #include <boost/tuple/tuple_comparison.hpp> > #include <boost/tuple/tuple_io.hpp> > #else > ... place here revelant forward declaration .... > #endif > > and possibly > > class OptimalCuts{ > > public : > #ifndef __CINT__ > boost::tuples::tuple<int, double>T; > #endif > > > Cheers, > Philippe. > > -----Original Message----- > From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On > Behalf Of Kevin Lynch > Sent: Wednesday, April 16, 2008 10:52 AM > To: aalvesju_at_cern.ch; augalves_at_cbpf.br > Cc: ROOT Talk > Subject: Re: [ROOT] Boost libraries and ROOT > > Antonio Augusto Alves Junior wrote: > >> Hello all, >> >> Please, can someone to give some example of usage of the Boost Libraries >> with ROOT? >> >> regards >> Augusto >> >> > > It's not clear what you are asking for. If you want to use Boost > libraries and the Root libraries in compiled code, you won't have any > issues. I do this all the time ... mostly I use stuff that ended up in > TR1 (smart_ptr, tuple, bind, function, etc), but I've also been known to > use multi_index, numeric_cast, random, and a few others. It all works > just fine. > > If you want to use some specific Boost library as interpreted code, then > you will likely be in for a long, tough slog to get it working. Boost > makes EXTREMELY heavy use of advanced template features, as well as lots > of config headers and #ifdef'd workarounds for various compilers and STL > implementations. You could modify all the headers and source files for > the Boost libraries you want to use to include the relevant CINT magic > (ClassDef/ClassImp and LinkDef.h files) and generate all the > dictionaries, and then load them up. You'll have to do all this work if > you want to persist Boost objects to TTrees/TFiles, since you need the > dictionary in this case. > > Personally, I've never bothered with all that ... if the project is > complicated enough that I need Boost, I'm going the compiled route > anyway. And I just accept that I'm too lazy to put any Boost objects in > TTrees or TFiles :-) > > Finally, a few years back, someone posted a message to roottalk about > efforts to Rootify the Boost smart pointers .... I think it was called > "ROOST". I haven't heard anything more since then, but perhaps there's > been some more progress. > >
-- "O mais corrente neste mundo, nestes tempos em que às cegas vamos tropeçando, é esbarrarmos, ao virar a esquina mais próxima, com homens e mulheres na maturidade da existência e da prosperidade, que, tendo sido aos dezoito anos briosos revolucionários decididos a arrasar o sistema dos pais e pôr no seu lugar o paraíso, enfim, da fraternidade, se encontram agora, com firmeza pelo menos igual, repoltreados em convicções e práticas que, depois de haverem passado por qualquer das muitas versões do conservadorismo moderado, acabaram por desembocar no mais desbocado e reaccionário egoísmo. Em palavras não tão cerimoniosas, estes homens e estas mulheres, diante do espelho da sua vida, cospem todos os dias na cara do que foram o escarro do que são." José Saramago, em Ensaio sobre a lucidez ============================================= A. Augusto Alves Jr. CBPF - Centro Brasileiro de Pesquisas Físicas Rua Dr. Xavier Sigaud 150 – URCA CEP 22290-180 Rio de Janeiro, RJ, Brazil. Tel: (55)(21) 2141-7329 Fax: (55)(21) 2141-7556Received on Wed Apr 16 2008 - 20:01:04 CEST
This archive was generated by hypermail 2.2.0 : Thu Apr 17 2008 - 05:50:02 CEST