[lttng-dev] linking c++ with shared object tracepoints

Aryeh Weinreb weinrea at gmail.com
Sun Jun 2 03:47:24 EDT 2013


>> Is supported to link c++ code with c compiled tracepoints put it a dynamic lib?

I mean to say the tracepoints put _in_ a dynamic lib before linking
with c++ code.
>
> Yes, I just tried it here.

Could you show me how with the easy-ust example?

> The header is probably fine and I'd advise againt modifying it without
> careful thought. Could you provide a short example reproducing the
> problem?

$cd doc/examples/easy-ust/
$ g++ -DTRACEPOINT_PROBE_DYNAMIC_LINKAGE  -I. -c -o sample.o sample.c
sample.c: In function 'int main(int, char**)':
sample.c:38: warning: deprecated conversion from string constant to 'char*'
$ gcc -fPIC -I. -c -o tp.o tp.c
$ gcc -I. -shared -o libtp.so tp.o
$ g++ -o sample sample.o -ldl -llttng-ust -L. -ltp
/usr/bin/ld: sample: hidden symbol `tracepoint_dlopen' in sample.o is
referenced by DSO
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: ld returned 1 exit status



More information about the lttng-dev mailing list