Skip to content

Commit

Permalink
Document run from shared object
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdymercury authored Apr 7, 2024
1 parent 34df2fe commit 871d587
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions manual/cling/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ This list is also available by typing `.?` or `.help` in the ROOT prompt.
.L <filename>[flags]: load the given file with optional flags like
+ to compile or ++ to force recompile.
Type .? TSystem::CompileMacro for a list of all flags.
<filename> can also be a shared library; skip flags.
.(x|X) <filename>[flags](args) :
same as .L <filename>[flags] and runs then a function
with signature: ret_type filename(args).
Expand Down
2 changes: 1 addition & 1 deletion manual/first_steps_with_root/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ Here a selection of commands:

`.!<OS_command>`: Accesses the shell of the operating system. For example `.!ls` or `.!pwd`.

`.x <file_name>`: Executes a ROOT macro.
`.x <file_name>`: 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 <file_name>`: Unloads a file.

Expand Down
7 changes: 7 additions & 0 deletions manual/root_macros_and_shared_libraries/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,18 @@ 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:

```
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:

```
Expand All @@ -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:
```
Expand Down Expand Up @@ -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:

Expand Down

0 comments on commit 871d587

Please sign in to comment.