tests: test_ust_constructor: Use a C-compiled static archive
[lttng-tools.git] / tests / utils / testapp / gen-ust-events-constructor / main.cpp
CommitLineData
a4cc1b1f
MD
1/*
2 * Copyright (C) 2023 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#include "obj.h"
8#include "tp-a.h"
ab4919b5 9#include "tp-a_c.h"
a4cc1b1f
MD
10#include "tp-so.h"
11#include "tp.h"
12
13/* Use tracepoints defined and provided by shared libraries. */
14void test_constructor_so(void) __attribute__((constructor));
15void test_constructor_so(void)
16{
17 tracepoint(tp_so, constructor_c_provider_shared_library);
18}
19
20void test_destructor_so(void) __attribute__((destructor));
21void test_destructor_so(void)
22{
23 tracepoint(tp_so, destructor_c_provider_shared_library);
24}
25
26Objso g_objso_shared_library("global - shared library define and provider");
27
28/* Use tracepoints defined and provided by static archive. */
29void test_constructor_a(void) __attribute__((constructor));
30void test_constructor_a(void)
31{
ab4919b5 32 tracepoint(tp_a_c, constructor_c_provider_static_archive);
a4cc1b1f
MD
33}
34
35void test_destructor_a(void) __attribute__((destructor));
36void test_destructor_a(void)
37{
ab4919b5 38 tracepoint(tp_a_c, destructor_c_provider_static_archive);
a4cc1b1f
MD
39}
40
41Obja g_obja_static_archive("global - static archive define and provider");
42
43int main(void)
44{
45 Obj l_obj("main() local");
46 Objso l_objso("main() local - shared library define and provider");
47 Obja l_obja("main() local - static archive define and provider");
48
49 tracepoint(tp, main);
50 return 0;
51}
This page took 0.028959 seconds and 4 git commands to generate.