Skip to content
Snippets Groups Projects
Commit 4e55acea authored by Frederich Munch's avatar Frederich Munch Committed by Axel Naumann
Browse files

Windows: Remove function pointer typedef polluting global scope.

parent f5808f12
No related branches found
No related tags found
No related merge requests found
...@@ -359,20 +359,22 @@ namespace cling { ...@@ -359,20 +359,22 @@ namespace cling {
#if defined(LLVM_ON_WIN32) #if defined(LLVM_ON_WIN32)
// Windows specific: _onexit, _onexit_m, __dllonexit // Windows specific: _onexit, _onexit_m, __dllonexit
if (NoRuntime) {
// Have to declare the function pointer types now and hope no conflicts.
#if !defined(_M_CEE) #if !defined(_M_CEE)
Strm << "typedef int (__cdecl* _onexit_t)(void)\n;"; const char* Spec = "__cdecl";
#else #else
Strm << "typedef int (__clrcall* _onexit_t)(void)\n"; const char* Spec = "__clrcall";
#endif #endif
} Strm << Linkage << " " << Spec << " int (*__dllonexit("
Strm << Linkage << " _onexit_t __dllonexit(_onexit_t f, void**, void**) { " << "int (" << Spec << " *f)(void**, void**), void**, void**))"
"__cxa_atexit((void(*)(void*))f, nullptr, __dso_handle); return f;}\n"; "(void**, void**) { "
"__cxa_atexit((void(*)(void*))f, nullptr, __dso_handle); return f;"
"}\n";
Globals.push_back("__dllonexit"); Globals.push_back("__dllonexit");
#if !defined(_M_CEE_PURE) #if !defined(_M_CEE_PURE)
Strm << Linkage << " _onexit_t _onexit(_onexit_t f) { " Strm << Linkage << " " << Spec << " int (*_onexit("
"__cxa_atexit((void(*)(void*))f, nullptr, __dso_handle); return f;}\n"; << "int (" << Spec << " *f)()))() { "
"__cxa_atexit((void(*)(void*))f, nullptr, __dso_handle); return f;"
"}\n";
Globals.push_back("_onexit"); Globals.push_back("_onexit");
#endif #endif
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment