xref: /aosp_15_r20/external/cronet/base/profiler/test_support_library.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2015 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Note: there is intentionally no header file associated with this library so
6 // we don't risk implicitly demand loading it by accessing a symbol.
7 
8 #include "build/build_config.h"
9 
10 #if BUILDFLAG(IS_WIN)
11 #define BASE_PROFILER_TEST_SUPPORT_LIBRARY_EXPORT __declspec(dllexport)
12 #else  // BUILDFLAG(IS_WIN)
13 #define BASE_PROFILER_TEST_SUPPORT_LIBRARY_EXPORT __attribute__((visibility("default")))
14 #endif
15 
16 namespace base {
17 
18 // Must be defined in an extern "C" block so we can look up the unmangled name.
19 extern "C" {
20 
InvokeCallbackFunction(void (* function)(void *),void * arg)21 BASE_PROFILER_TEST_SUPPORT_LIBRARY_EXPORT void InvokeCallbackFunction(
22     void (*function)(void*),
23     void* arg) {
24   function(arg);
25   // Prevent tail call.
26   [[maybe_unused]] volatile int i = 0;
27   i = 1;
28 }
29 
30 }  // extern "C"
31 
32 }  // namespace base
33