List Info

Thread: RE: load a list of libs




RE: load a list of libs
country flaguser name
United States
2008-03-10 14:16:10
Hello Dmitry,

> The reason of my question is motivated by a simple
idea. 

My point was a simple one, "You can write
LoadListOfLibs() yourself".
The function you proposed us is useful (and ROOT team may be
willing to add  it ;). However, it is not as generic as you
implied.

Normally, the function you proposed is NOT sufficient to
meet the current framework need. 

For example, what LoadListOfLibs() function should have done
if let's say one of the libraries fails to be loaded?

> On the other hand G4 always provides a nice
> method similar to that in root-config. It can return me
a line with all
> libraries like:
> -lG4_lib1 -lG4lib2 ... -lG4libN

What about:

g++ -o Root4G4.exe $ROOTSYS/main/src/rmain.cxx `root-config
--cflags --glibs `your nice G4 config script here'


Is it what you want?



Best Regards
                         Valeri Fine
---------------
Brookhaven National Laboratory
Upton, NY 11973, USA
Phone: +1 631 344 7806
Fax:   +1 631 344 4206
E-mail: finebnl.gov

> -----Original Message-----
> From: naumovnusun.jinr.ru [mailto:naumovnusun.jinr.ru]
> Sent: Monday, March 10, 2008 6:39 PM
> To: Fine, Valeri
> Cc: Dmitry Naumov; Dario Berzano; roottalkcern.ch
> Subject: RE: [ROOT] load a list of libs
> 
> Hi Valeri,
> 
> thanks for your response. Well, this is again the same
gSystem->Load()
> function. Certainly I could do this kind of loop...
> 
> The reason of my question is motivated by a simple
idea. I am using ROOT
> VMC in my application. If I run it from the root
interpreter I use a macro
> which loads several dozens of Geant4 libraries. From
release to release G4
> merges/splits/renames some libraries and I have to
follow all these
> developments in that macro. On the other hand G4 always
provides a nice
> method similar to that in root-config. It can return me
a line with all
> libraries like:
> -lG4_lib1 -lG4lib2 ... -lG4libN
> 
> and like this for several dozens of libraries.
Therefore I though that it
> would be nice if instead of using a macro which loads
one by one all the
> libraries I would simply ask root to load everything in
one go. Well, one
> can say, please, split the line and use again
gSystem->Load() substituting
> -lG4_lib1 by libG4lib1.so (thus analyzing the string).
Certainly this is
> possible and quite easy to realize, while it would be a
sort of
> comfortable to be able to load everything just by a
line like:
> gSystem->LoadListOfLibs("")
> 
> This is the point. Ok, if  this is not possible I will
proceed with a
> loop, thanks again, Dmitry
> 
> >> Hi Dario,
> >>
> >> this I know. But this command seems to load
only one library. Is there
> >> something like:
> >> root[]
gSystem->LoadListOfLibs("-L/path_to_libs -lApp1
-lApp2 -lApp3");
> >
> > Yes, it does exist. Here you are 
> >
> > {
> >    TString lPath = gSystem->GetDynamicPath();
> >    lPath+= ":path_to_libs";
> >    gSystem->SetDynamicPath((const
char*)lPath);
> >    const char *libs[] = { "App1",
"App2", "App3" };
> >    for (int i = 0; i < sizeof(libs)/sizeof(char
*); i++)
> >       printf(" Loading %s %dn",
libs[i], gSystem->Load(libs[i]));
> >
> > }
> >
> > Hope this helps
> >
> >                          Valeri Fine
> > ---------------
> > Brookhaven National Laboratory
> > Upton, NY 11973, USA
> > Phone: +1 631 344 7806
> > Fax:     +1 631 344 4206
> > E-mail: finebnl.gov
> >> Thanks, Dmitry
> >>
> >> Dario Berzano �����:
> >> > On Mon, Mar 10, 2008 at 6:06 PM, Dmitry
Naumov <naumovnusun.jinr.ru>
> >> wrote:
> >> >
> >> >> Dear roottalk,
> >> >>
> >> >>  is there an implemented way to load
a list of libraries made in the
> >> form:
> >> >>  -L/path_to_libs -lApp1 -lApp2 -lApp3
...
> >> >>  from the root interpreter?
> >> >>
> >> >
> >> > Hi Dmitry,
> >> >
> >> >   you can try
gSystem->Load("library_name"). The
documentation is
> >> > available here:
> >> >
> >> >   http://root.cern.ch/root/html/TSystem.html#TSystem:Load
> >> >
> >> > Regards,
> >> >
> >

Re: load a list of libs
country flaguser name
Russian Federation
2008-03-11 04:36:59
Hello Valery, Philippe and roottalk,

thank you for your answers. I think I got a complete answer
to my 
question. Frankly speaking I would like to see something
like I proposed 
but maybe done in a more generic and sufficient way in one
of the next 
root releases if others also find this useful. For the time
being I will 
implement this kind of function for my purpose based on
Valery's piece 
of code.

Philippe, I do not think to know the subject well enough to
volunteer to 
make my contribution to TSystem class. 

Valery, for my application stand-alone I used something
similar to your suggestion below:

g++ -o Root4G4.exe $ROOTSYS/main/src/rmain.cxx `root-config
--cflags --glibs `your nice G4 config script here'

However I could not use the same trick for the root
interpreter.

For example, what LoadListOfLibs() function should have done
if let's say one of the libraries fails to be loaded?

I guess naively, root will say:
failed to load "libXXX", no? 

Thanks to all,
Best regards, Dmitry


Fine, Valeri ÐÉÛÅÔ:
> Hello Dmitry,
>
>   
>> The reason of my question is motivated by a simple
idea. 
>>     
>
> My point was a simple one, "You can write
LoadListOfLibs() yourself".
> The function you proposed us is useful (and ROOT team
may be willing to add  it ;). However, it is not as generic
as you implied.
>
> Normally, the function you proposed is NOT sufficient
to meet the current framework need. 
>
> For example, what LoadListOfLibs() function should have
done if let's say one of the libraries fails to be loaded?
>
>   
>> On the other hand G4 always provides a nice
>> method similar to that in root-config. It can
return me a line with all
>> libraries like:
>> -lG4_lib1 -lG4lib2 ... -lG4libN
>>     
>
> What about:
>
> g++ -o Root4G4.exe $ROOTSYS/main/src/rmain.cxx
`root-config --cflags --glibs `your nice G4 config script
here'
>
>
> Is it what you want?
>
>
>
> Best Regards
>                          Valeri Fine
> ---------------
> Brookhaven National Laboratory
> Upton, NY 11973, USA
> Phone: +1 631 344 7806
> Fax:   +1 631 344 4206
> E-mail: finebnl.gov
>
>   
>> -----Original Message-----
>> From: naumovnusun.jinr.ru [mailto:naumovnusun.jinr.ru]
>> Sent: Monday, March 10, 2008 6:39 PM
>> To: Fine, Valeri
>> Cc: Dmitry Naumov; Dario Berzano; roottalkcern.ch
>> Subject: RE: [ROOT] load a list of libs
>>
>> Hi Valeri,
>>
>> thanks for your response. Well, this is again the
same gSystem->Load()
>> function. Certainly I could do this kind of
loop...
>>
>> The reason of my question is motivated by a simple
idea. I am using ROOT
>> VMC in my application. If I run it from the root
interpreter I use a macro
>> which loads several dozens of Geant4 libraries.
From release to release G4
>> merges/splits/renames some libraries and I have to
follow all these
>> developments in that macro. On the other hand G4
always provides a nice
>> method similar to that in root-config. It can
return me a line with all
>> libraries like:
>> -lG4_lib1 -lG4lib2 ... -lG4libN
>>
>> and like this for several dozens of libraries.
Therefore I though that it
>> would be nice if instead of using a macro which
loads one by one all the
>> libraries I would simply ask root to load
everything in one go. Well, one
>> can say, please, split the line and use again
gSystem->Load() substituting
>> -lG4_lib1 by libG4lib1.so (thus analyzing the
string). Certainly this is
>> possible and quite easy to realize, while it would
be a sort of
>> comfortable to be able to load everything just by a
line like:
>> gSystem->LoadListOfLibs("")
>>
>> This is the point. Ok, if  this is not possible I
will proceed with a
>> loop, thanks again, Dmitry
>>
>>     
>>>> Hi Dario,
>>>>
>>>> this I know. But this command seems to load
only one library. Is there
>>>> something like:
>>>> root[]
gSystem->LoadListOfLibs("-L/path_to_libs -lApp1
-lApp2 -lApp3");
>>>>         
>>> Yes, it does exist. Here you are 
>>>
>>> {
>>>    TString lPath =
gSystem->GetDynamicPath();
>>>    lPath+= ":path_to_libs";
>>>    gSystem->SetDynamicPath((const
char*)lPath);
>>>    const char *libs[] = { "App1",
"App2", "App3" };
>>>    for (int i = 0; i <
sizeof(libs)/sizeof(char *); i++)
>>>       printf(" Loading %s %dn",
libs[i], gSystem->Load(libs[i]));
>>>
>>> }
>>>
>>> Hope this helps
>>>
>>>                          Valeri Fine
>>> ---------------
>>> Brookhaven National Laboratory
>>> Upton, NY 11973, USA
>>> Phone: +1 631 344 7806
>>> Fax:     +1 631 344 4206
>>> E-mail: finebnl.gov
>>>       
>>>> Thanks, Dmitry
>>>>
>>>> Dario Berzano �����:
>>>>         
>>>>> On Mon, Mar 10, 2008 at 6:06 PM, Dmitry
Naumov <naumovnusun.jinr.ru>
>>>>>           
>>>> wrote:
>>>>         
>>>>>> Dear roottalk,
>>>>>>
>>>>>>  is there an implemented way to
load a list of libraries made in the
>>>>>>             
>>>> form:
>>>>         
>>>>>>  -L/path_to_libs -lApp1 -lApp2
-lApp3 ...
>>>>>>  from the root interpreter?
>>>>>>
>>>>>>             
>>>>> Hi Dmitry,
>>>>>
>>>>>   you can try
gSystem->Load("library_name"). The
documentation is
>>>>> available here:
>>>>>
>>>>>   http://root.cern.ch/root/html/TSystem.html#TSystem:Load
>>>>>
>>>>> Regards,
>>>>>
>>>>>           
>
>   


Re: load a list of libs
country flaguser name
France
2008-03-21 07:21:16
Hi Dmitry,

Geant4 VMC provides a macro for loading all Geant4
libraries
needed for user application in:
geant4_vmc/examples/macro/g4libs.C
This macro is regularly updated with each Geant4 release
and
you can follow the changes using SVN.

Best regards,

Ivana

-- 
============================================================
==
e-mail:  Ivana.Hrivnacovacern.ch
address: Institut Physique Nucleaire, 91406 Orsay, France
phone:   (33) 01 69 15 65 94
============================================================
==

Dmitry Naumov wrote:
> Hello Valery, Philippe and roottalk,
> 
> thank you for your answers. I think I got a complete
answer to my 
> question. Frankly speaking I would like to see
something like I proposed 
> but maybe done in a more generic and sufficient way in
one of the next 
> root releases if others also find this useful. For the
time being I will 
> implement this kind of function for my purpose based on
Valery's piece 
> of code.
> 
> Philippe, I do not think to know the subject well
enough to volunteer to 
> make my contribution to TSystem class. 
> 
> Valery, for my application stand-alone I used something
similar to your 
> suggestion below:
> 
> g++ -o Root4G4.exe $ROOTSYS/main/src/rmain.cxx
`root-config --cflags 
> --glibs `your nice G4 config script here'
> 
> However I could not use the same trick for the root
interpreter.
> 
> For example, what LoadListOfLibs() function should have
done if let's 
> say one of the libraries fails to be loaded?
> 
> I guess naively, root will say:
> failed to load "libXXX", no? 
> 
> Thanks to all,
> Best regards, Dmitry
> 
> 
> Fine, Valeri ÐÉÛÅÔ:
>> Hello Dmitry,
>>
>>  
>>> The reason of my question is motivated by a
simple idea.     
>>
>> My point was a simple one, "You can write
LoadListOfLibs() yourself".
>> The function you proposed us is useful (and ROOT
team may be willing 
>> to add  it ;). However, it is not as generic as you
implied.
>>
>> Normally, the function you proposed is NOT
sufficient to meet the 
>> current framework need.
>> For example, what LoadListOfLibs() function should
have done if let's 
>> say one of the libraries fails to be loaded?
>>
>>  
>>> On the other hand G4 always provides a nice
>>> method similar to that in root-config. It can
return me a line with all
>>> libraries like:
>>> -lG4_lib1 -lG4lib2 ... -lG4libN
>>>     
>>
>> What about:
>>
>> g++ -o Root4G4.exe $ROOTSYS/main/src/rmain.cxx
`root-config --cflags 
>> --glibs `your nice G4 config script here'
>>
>>
>> Is it what you want?
>>
>>
>>
>> Best Regards
>>                          Valeri Fine
>> ---------------
>> Brookhaven National Laboratory
>> Upton, NY 11973, USA
>> Phone: +1 631 344 7806
>> Fax:   +1 631 344 4206
>> E-mail: finebnl.gov
>>
>>  
>>> -----Original Message-----
>>> From: naumovnusun.jinr.ru
[mailto:naumovnusun.jinr.ru]
>>> Sent: Monday, March 10, 2008 6:39 PM
>>> To: Fine, Valeri
>>> Cc: Dmitry Naumov; Dario Berzano; roottalkcern.ch
>>> Subject: RE: [ROOT] load a list of libs
>>>
>>> Hi Valeri,
>>>
>>> thanks for your response. Well, this is again
the same gSystem->Load()
>>> function. Certainly I could do this kind of
loop...
>>>
>>> The reason of my question is motivated by a
simple idea. I am using ROOT
>>> VMC in my application. If I run it from the
root interpreter I use a 
>>> macro
>>> which loads several dozens of Geant4 libraries.
From release to 
>>> release G4
>>> merges/splits/renames some libraries and I have
to follow all these
>>> developments in that macro. On the other hand
G4 always provides a nice
>>> method similar to that in root-config. It can
return me a line with all
>>> libraries like:
>>> -lG4_lib1 -lG4lib2 ... -lG4libN
>>>
>>> and like this for several dozens of libraries.
Therefore I though 
>>> that it
>>> would be nice if instead of using a macro which
loads one by one all the
>>> libraries I would simply ask root to load
everything in one go. Well, 
>>> one
>>> can say, please, split the line and use again
gSystem->Load() 
>>> substituting
>>> -lG4_lib1 by libG4lib1.so (thus analyzing the
string). Certainly this is
>>> possible and quite easy to realize, while it
would be a sort of
>>> comfortable to be able to load everything just
by a line like:
>>> gSystem->LoadListOfLibs("")
>>>
>>> This is the point. Ok, if  this is not possible
I will proceed with a
>>> loop, thanks again, Dmitry
>>>
>>>    
>>>>> Hi Dario,
>>>>>
>>>>> this I know. But this command seems to
load only one library. Is there
>>>>> something like:
>>>>> root[]
gSystem->LoadListOfLibs("-L/path_to_libs -lApp1
-lApp2 
>>>>> -lApp3");
>>>>>         
>>>> Yes, it does exist. Here you are 
>>>>
>>>> {
>>>>    TString lPath =
gSystem->GetDynamicPath();
>>>>    lPath+= ":path_to_libs";
>>>>    gSystem->SetDynamicPath((const
char*)lPath);
>>>>    const char *libs[] = { "App1",
"App2", "App3" };
>>>>    for (int i = 0; i <
sizeof(libs)/sizeof(char *); i++)
>>>>       printf(" Loading %s %dn",
libs[i], gSystem->Load(libs[i]));
>>>>
>>>> }
>>>>
>>>> Hope this helps
>>>>
>>>>                          Valeri Fine
>>>> ---------------
>>>> Brookhaven National Laboratory
>>>> Upton, NY 11973, USA
>>>> Phone: +1 631 344 7806
>>>> Fax:     +1 631 344 4206
>>>> E-mail: finebnl.gov
>>>>      
>>>>> Thanks, Dmitry
>>>>>
>>>>> Dario Berzano �����:
>>>>>        
>>>>>> On Mon, Mar 10, 2008 at 6:06 PM,
Dmitry Naumov <naumovnusun.jinr.ru>
>>>>>>           
>>>>> wrote:
>>>>>        
>>>>>>> Dear roottalk,
>>>>>>>
>>>>>>>  is there an implemented way to
load a list of libraries made in the
>>>>>>>             
>>>>> form:
>>>>>        
>>>>>>>  -L/path_to_libs -lApp1 -lApp2
-lApp3 ...
>>>>>>>  from the root interpreter?
>>>>>>>
>>>>>>>             
>>>>>> Hi Dmitry,
>>>>>>
>>>>>>   you can try
gSystem->Load("library_name"). The
documentation is
>>>>>> available here:
>>>>>>
>>>>>>   http://root.cern.ch/root/html/TSystem.html#TSystem:Load
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>>           
>>
>>   
> 
> 


Re: load a list of libs
country flaguser name
Russian Federation
2008-03-21 08:48:38
Hi Ivana,

thanks for your reply. Yes, I am aware about this macro.
However as I 
built a sort of own application (+macros) I have anyway to
trace changes 
in geant4_vmc/examples/macro/g4libs.C in order to update my
own modified 
g4libs.C

On the other hand during recent discussion on this point I
got several 
suggestions and a very nice function from Christian Holm
Christensen 
(cholmnbi.dk) which we iterated among us. This function 
reads a char* 
with a full list of G4 libs in the form -L/path -lib1 -lib2
...-libN and 
loads them one by one in the memory. This input char* is
prepared from 
G4 liblist function. I find this way rather comfortable.
Perhaps you may 
find this useful as well as you will need not follow G4
modifications 
and you will have always up-to-date g4libs.C macro? There is
only one 
odd-thing - it loads ALL g4 libs, while we need just some of
them. 
Perhaps this could be sorted out somehow...

Best regards, Dmitry

Ivana Hrivnacova ÐÉÛÅÔ:
> Hi Dmitry,
>
> Geant4 VMC provides a macro for loading all Geant4
libraries
> needed for user application in:
> geant4_vmc/examples/macro/g4libs.C
> This macro is regularly updated with each Geant4
release and
> you can follow the changes using SVN.
>
> Best regards,
>
> Ivana
>


Re: load a list of libs
country flaguser name
France
2008-03-21 11:11:38

Dmitry Naumov wrote:
> Hi Ivana,
> 
> thanks for your reply. Yes, I am aware about this
macro. However as I 
> built a sort of own application (+macros) I have anyway
to trace changes 
> in geant4_vmc/examples/macro/g4libs.C in order to
update my own modified 
> g4libs.C

Ok.
> 
> On the other hand during recent discussion on this
point I got several 
> suggestions and a very nice function from Christian
Holm Christensen 
> (cholmnbi.dk) which we iterated among us. This function 
reads a char* 
> with a full list of G4 libs in the form -L/path -lib1
-lib2 ...-libN and 
> loads them one by one in the memory. This input char*
is prepared from 
> G4 liblist function. I find this way rather
comfortable. Perhaps you may 
> find this useful as well as you will need not follow G4
modifications 
> and you will have always up-to-date g4libs.C macro?
There is only one 
> odd-thing - it loads ALL g4 libs, while we need just
some of them. 
> Perhaps this could be sorted out somehow...

Could you send me it offline this mailing list?
Thank you,

Ivana


> 
> Best regards, Dmitry
> 
> Ivana Hrivnacova ÐÉÛÅÔ:
>> Hi Dmitry,
>>
>> Geant4 VMC provides a macro for loading all Geant4
libraries
>> needed for user application in:
>> geant4_vmc/examples/macro/g4libs.C
>> This macro is regularly updated with each Geant4
release and
>> you can follow the changes using SVN.
>>
>> Best regards,
>>
>> Ivana
>>
> 

-- 
============================================================
==
e-mail:  Ivana.Hrivnacovacern.ch
address: Institut Physique Nucleaire, 91406 Orsay, France
phone:   (33) 01 69 15 65 94
============================================================
==


[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )