• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2017 VMware, Inc.
2 // Licensed under the Apache License, Version 2.0 (the "License")
3 #include <cstdlib>
4 
5 #include "bcc_usdt.h"
6 
7 namespace {
8   // Take this trick from llvm for forcing exported functions in helper
9   // libraries to be included in the final .so
10   struct LinkAll {
LinkAll__anond796b1640111::LinkAll11     LinkAll() {
12       // getenv never returns -1, but compiler doesn't know!
13       if (::getenv("bar") != (char *)-1)
14         return;
15 
16 #ifdef EXPORT_USDT
17       (void)bcc_usdt_new_frompid(-1, nullptr);
18       (void)bcc_usdt_new_frompath(nullptr);
19       (void)bcc_usdt_close(nullptr);
20 #endif
21     }
22   } LinkAll;  // declare one instance to invoke the constructor
23 }
24