Automatically load .so libraries upon entering Root

Good day.

I have created some libraries as a .so file and I was wondering if there is a way to load those files automatically instead of doing:

Each time I execute Root.

Anyone know if this is possible?
And if so, how?

Thanks in advance.

I am also interested in knowing if such thing is possible.
I have some .so libraries that I would like to automatically load whenever I enter Root.
If we have to specify a path or copy the .so to a certain directory or whatever it is.
If someone knows a way, please let us know!

It is possible. See
root.cern.ch/download/doc/ROOTU … 02s07.html

Just create a file .rootrc in your HOME containing:

And a file rootlogon.C in your HOME containing:

{
	gSystem->Load("/home/......./mylibrary.so");
	cout << "\tNote: Loaded library mylibrary." << endl;
	
	//Optionally add include files of your library contained in folder inc:
	//gInterpreter->AddIncludePath("/home/......./mylibrary/inc/");
}

Thanks ferhue for the info. :slight_smile:
I managed to get it working by changing system.rootrc and adding the exact path for rootalias.C, rootlogoff.C and rootlogon.C. I had to specify the path or ROOT wouldn’t load them up.

Rint.Load: /etc/root/rootalias.C Rint.Logon: /etc/root/rootlogon.C Rint.Logoff: /etc/root/rootlogoff.C

Ok, but this loads for all users of the computer this library. If you only want to load for one user, you have to put a file .rootrc in your home folder and another rootlogon.C also there. The .rootrc in your home gets also searched for user-defined routines (compared to all-system-users).