From 871d587cc4b8b645e932adffb60b429d5c60b01c Mon Sep 17 00:00:00 2001 From: ferdymercury Date: Sun, 7 Apr 2024 18:47:22 +0200 Subject: [PATCH] Document run from shared object Matches https://github.com/root-project/root/pull/14813/. --- manual/cling/index.md | 1 + manual/first_steps_with_root/index.md | 2 +- manual/root_macros_and_shared_libraries/index.md | 7 +++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/manual/cling/index.md b/manual/cling/index.md index 811b0bc8..20644e0a 100644 --- a/manual/cling/index.md +++ b/manual/cling/index.md @@ -257,6 +257,7 @@ This list is also available by typing `.?` or `.help` in the ROOT prompt. .L [flags]: load the given file with optional flags like + to compile or ++ to force recompile. Type .? TSystem::CompileMacro for a list of all flags. + can also be a shared library; skip flags. .(x|X) [flags](args) : same as .L [flags] and runs then a function with signature: ret_type filename(args). diff --git a/manual/first_steps_with_root/index.md b/manual/first_steps_with_root/index.md index d6493a5c..b6d8ba1e 100644 --- a/manual/first_steps_with_root/index.md +++ b/manual/first_steps_with_root/index.md @@ -159,7 +159,7 @@ Here a selection of commands: `.!`: Accesses the shell of the operating system. For example `.!ls` or `.!pwd`. -`.x `: Executes a ROOT macro. +`.x `: Executes a ROOT macro. file_name can be also a precompiled macro or a regular shared library userlib.so (or .dll) with a function userlib(args). `.U `: Unloads a file. diff --git a/manual/root_macros_and_shared_libraries/index.md b/manual/root_macros_and_shared_libraries/index.md index 36540738..4f786d77 100644 --- a/manual/root_macros_and_shared_libraries/index.md +++ b/manual/root_macros_and_shared_libraries/index.md @@ -59,6 +59,7 @@ You can execute a ROOT macro in one of three ways: > > By adding further space-separated file names to the line above, you can sequentially execute multiple > macros in the same ROOT session, as long as they don't share the same name. + > You can also replace MacroName.C with MacroName_C.so if you compiled your macro with ACLiC beforehand. 2. Execute a macro at the ROOT prompt: @@ -66,6 +67,10 @@ You can execute a ROOT macro in one of three ways: root [0] .x MacroName.C ``` + > **Note** + > + > You can also replace MacroName.C with MacroName_C.so if you compiled your macro with ACLiC beforehand. + 3. Load a macro from within a ROOT session and then call the function: ``` @@ -77,6 +82,7 @@ You can execute a ROOT macro in one of three ways: > > You can load multiple macros in the same ROOT session (one .L statement for each), > as long as they don't have the same name. + > You can also replace MacroName.C with MacroName_C.so if you compiled your macro with ACLiC beforehand. It is also possible to pass parameters directly to the macro function: ``` @@ -157,6 +163,7 @@ root [0] .L MyScript.C+ The `+` option compiles the code and generates a shared library `MyScript_C.so` (`MyScript_C.dll` on Windows). The `+` command rebuilds the library only if the ROOT macro or any of the files it includes are newer than the library. To force a recompilation of the library, use `++`. +Once compiled, the shared library name can be directly passed in place of `MyScript.C` when calling `.L` or `.x`. You can also compile, build and run with arguments in a one-liner using: