X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=contents%2Fusing-lttng%2Finstrumenting%2Fc-application%2Fbuilding-linking%2Fdynamic-linking.md;h=e52363bc78715ea0b5bf02f2f03e14ab6193d013;hb=cd41f97c42df5747599d1c8d107d7afc3968ee32;hp=1284be60bca02dd7fd80d7bf330ff02c1d05b6d4;hpb=0cc0308005e95e4a03a60b4eb3b29e8a00065b0f;p=lttng-docs.git diff --git a/contents/using-lttng/instrumenting/c-application/building-linking/dynamic-linking.md b/contents/using-lttng/instrumenting/c-application/building-linking/dynamic-linking.md index 1284be6..e52363b 100644 --- a/contents/using-lttng/instrumenting/c-application/building-linking/dynamic-linking.md +++ b/contents/using-lttng/instrumenting/c-application/building-linking/dynamic-linking.md @@ -19,11 +19,27 @@ The process to create the tracepoint provider shared object is pretty much the same as the static library method, except that: * since the tracepoint provider is not part of the application - anymore, `TRACEPOINT_DEFINE` _must_ be defined in one translation - unit (C source file) of the _application_; + anymore, `TRACEPOINT_DEFINE` _must_ be defined, for each tracepoint + provider, in exactly one translation unit (C source file) of the + _application_; * `TRACEPOINT_PROBE_DYNAMIC_LINKAGE` must be defined next to `TRACEPOINT_DEFINE`. +Regarding `TRACEPOINT_DEFINE` and `TRACEPOINT_PROBE_DYNAMIC_LINKAGE`, +the recommended practice is to use a separate C source file in your +application to define them, and then include the tracepoint provider +header files afterwards, e.g.: + +~~~ c +#define TRACEPOINT_DEFINE +#define TRACEPOINT_PROBE_DYNAMIC_LINKAGE + +/* include the header files of one or more tracepoint providers below */ +#include "tp1.h" +#include "tp2.h" +#include "tp3.h" +~~~ + `TRACEPOINT_PROBE_DYNAMIC_LINKAGE` makes the macros included afterwards (by including the tracepoint provider header, which itself includes LTTng-UST headers) aware that the tracepoint provider is to be loaded @@ -67,3 +83,4 @@ LTTng-UST tracing support:
 ./app
 
+