mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 03:15:07 -04:00
Use explicit symbol visibility control in GCC/clang
This commit is contained in:
parent
419eadb859
commit
236b0c590c
@ -431,6 +431,9 @@
|
|||||||
#if defined(WIN32_VC) && !defined(CPPPARSER) && !defined(LINK_ALL_STATIC)
|
#if defined(WIN32_VC) && !defined(CPPPARSER) && !defined(LINK_ALL_STATIC)
|
||||||
#define EXPORT_CLASS __declspec(dllexport)
|
#define EXPORT_CLASS __declspec(dllexport)
|
||||||
#define IMPORT_CLASS __declspec(dllimport)
|
#define IMPORT_CLASS __declspec(dllimport)
|
||||||
|
#elif __GNUC__ >= 4 && !defined(CPPPARSER) && !defined(LINK_ALL_STATIC)
|
||||||
|
#define EXPORT_CLASS __attribute__((visibility("default")))
|
||||||
|
#define IMPORT_CLASS
|
||||||
#else
|
#else
|
||||||
#define EXPORT_CLASS
|
#define EXPORT_CLASS
|
||||||
#define IMPORT_CLASS
|
#define IMPORT_CLASS
|
||||||
|
@ -97,7 +97,12 @@
|
|||||||
/* These two are always defined empty, because pystub is statically
|
/* These two are always defined empty, because pystub is statically
|
||||||
built. But we leave the symbol around in case we change our minds
|
built. But we leave the symbol around in case we change our minds
|
||||||
to make pystub once again be a dynamic library. */
|
to make pystub once again be a dynamic library. */
|
||||||
|
#if __GNUC__ >= 4
|
||||||
|
/* In GCC, though, we still need to mark the symbols as visible. */
|
||||||
|
#define EXPCL_PYSTUB __attribute__((visibility("default")))
|
||||||
|
#else
|
||||||
#define EXPCL_PYSTUB
|
#define EXPCL_PYSTUB
|
||||||
|
#endif
|
||||||
#define EXPTP_PYSTUB
|
#define EXPTP_PYSTUB
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -135,6 +135,8 @@ int write_python_table_native(ostream &out) {
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "#ifdef _WIN32\n"
|
<< "#ifdef _WIN32\n"
|
||||||
<< "extern \"C\" __declspec(dllexport) PyObject *PyInit_" << library_name << "();\n"
|
<< "extern \"C\" __declspec(dllexport) PyObject *PyInit_" << library_name << "();\n"
|
||||||
|
<< "#elif __GNUC__ >= 4\n"
|
||||||
|
<< "extern \"C\" __attribute__((visibility(\"default\"))) PyObject *PyInit_" << library_name << "();\n"
|
||||||
<< "#else\n"
|
<< "#else\n"
|
||||||
<< "extern \"C\" PyObject *PyInit_" << library_name << "();\n"
|
<< "extern \"C\" PyObject *PyInit_" << library_name << "();\n"
|
||||||
<< "#endif\n"
|
<< "#endif\n"
|
||||||
@ -180,6 +182,8 @@ int write_python_table_native(ostream &out) {
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "#ifdef _WIN32\n"
|
<< "#ifdef _WIN32\n"
|
||||||
<< "extern \"C\" __declspec(dllexport) void init" << library_name << "();\n"
|
<< "extern \"C\" __declspec(dllexport) void init" << library_name << "();\n"
|
||||||
|
<< "#elif __GNUC__ >= 4\n"
|
||||||
|
<< "extern \"C\" __attribute__((visibility(\"default\"))) void init" << library_name << "();\n"
|
||||||
<< "#else\n"
|
<< "#else\n"
|
||||||
<< "extern \"C\" void init" << library_name << "();\n"
|
<< "extern \"C\" void init" << library_name << "();\n"
|
||||||
<< "#endif\n"
|
<< "#endif\n"
|
||||||
|
@ -125,8 +125,9 @@ INLINE ostream &operator << (ostream &out, NotifyCategoryProxy<GetCategory> &pro
|
|||||||
// appear in the config_*.h file. The proxy object will be named
|
// appear in the config_*.h file. The proxy object will be named
|
||||||
// basename_cat.
|
// basename_cat.
|
||||||
|
|
||||||
#if defined(WIN32_VC) && !defined(CPPPARSER)
|
#ifdef CPPPARSER
|
||||||
|
#define NotifyCategoryDecl(basename, expcl, exptp)
|
||||||
|
#else
|
||||||
#define NotifyCategoryDecl(basename, expcl, exptp) \
|
#define NotifyCategoryDecl(basename, expcl, exptp) \
|
||||||
class expcl NotifyCategoryGetCategory_ ## basename { \
|
class expcl NotifyCategoryGetCategory_ ## basename { \
|
||||||
public: \
|
public: \
|
||||||
@ -135,18 +136,7 @@ INLINE ostream &operator << (ostream &out, NotifyCategoryProxy<GetCategory> &pro
|
|||||||
}; \
|
}; \
|
||||||
exptp template class expcl NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename>; \
|
exptp template class expcl NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename>; \
|
||||||
extern expcl NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename> basename ## _cat;
|
extern expcl NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename> basename ## _cat;
|
||||||
|
#endif
|
||||||
#else // WIN32_VC
|
|
||||||
|
|
||||||
#define NotifyCategoryDecl(basename, expcl, exptp) \
|
|
||||||
class NotifyCategoryGetCategory_ ## basename { \
|
|
||||||
public: \
|
|
||||||
NotifyCategoryGetCategory_ ## basename(); \
|
|
||||||
static NotifyCategory *get_category(); \
|
|
||||||
}; \
|
|
||||||
extern NotifyCategoryProxy<NotifyCategoryGetCategory_ ## basename> basename ## _cat;
|
|
||||||
|
|
||||||
#endif // WIN32_VC
|
|
||||||
|
|
||||||
// This macro is the same as the above, except that it declares a category
|
// This macro is the same as the above, except that it declares a category
|
||||||
// that is not intended to be exported from any DLL.
|
// that is not intended to be exported from any DLL.
|
||||||
|
@ -1160,6 +1160,8 @@ def CompileCxx(obj,src,opts):
|
|||||||
if (opt=="ALWAYS") or (opt in opts): cmd += ' -D' + var + '=' + val
|
if (opt=="ALWAYS") or (opt in opts): cmd += ' -D' + var + '=' + val
|
||||||
for x in ipath: cmd += ' -I' + x
|
for x in ipath: cmd += ' -I' + x
|
||||||
|
|
||||||
|
cmd += ' -fvisibility=hidden'
|
||||||
|
|
||||||
# Mac-specific flags.
|
# Mac-specific flags.
|
||||||
if GetTarget() == "darwin":
|
if GetTarget() == "darwin":
|
||||||
cmd += " -Wno-deprecated-declarations"
|
cmd += " -Wno-deprecated-declarations"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user