Babeltrace 2 C API 2.1.0
Open-source trace manipulation framework
Loading...
Searching...
No Matches
Compile and link a Babeltrace 2 shared object plugin

To compile and link a Babeltrace 2 shared object plugin:

  1. Compile the C/C++ source files of the plugin with the -fPIC and -c compiler options to produce position-independent code and to compile without linking:

    $ cc my-plugin.c analysis.c -fPIC -c $(pkg-config --cflags babeltrace2)

  2. Link the resulting object files with the -shared linker option and with the Babeltrace 2 library:

    $ ld my-plugin.o analysis.o -o my-plugin.so -shared $(pkg-config --libs babeltrace2)
    Note
    If you're using LLD, then make sure to pass the -z notext option to the linker to allow relocations in read-only segments.
Note
At least one of your C/C++ files must declare a Babeltrace 2 plugin and one or more component classes using the Plugin development macros.