#include <folly/ScopeGuard.h>
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__)
-static void hs_init_weak(int* argc, char** argv[])
- __attribute__((__weakref__("hs_init")));
+#define FOLLY_SINGLETON_HAVE_DLSYM 1
#endif
namespace folly {
+#if FOLLY_SINGLETON_HAVE_DLSYM
+namespace detail {
+static void singleton_hs_init_weak(int* argc, char** argv[])
+ __attribute__((__weakref__("hs_init")));
+} // namespace detail
+#endif
+
SingletonVault::Type SingletonVault::defaultVaultType() {
-#if !defined(_WIN32) && !defined(__APPLE__) && !defined(__ANDROID__)
+#if FOLLY_SINGLETON_HAVE_DLSYM
bool isPython = dlsym(RTLD_DEFAULT, "Py_Main");
- bool isHaskel = &::hs_init_weak || dlsym(RTLD_DEFAULT, "hs_init");
+ bool isHaskel =
+ detail::singleton_hs_init_weak || dlsym(RTLD_DEFAULT, "hs_init");
bool isJVM = dlsym(RTLD_DEFAULT, "JNI_GetCreatedJavaVMs");
bool isD = dlsym(RTLD_DEFAULT, "_d_run_main");