mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
Set visibility attributes on all exported bindings
This commit is contained in:
parent
1e6ca1451e
commit
d3487eba6b
@ -53,6 +53,14 @@ InterfaceMakerC::
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void InterfaceMakerC::
|
||||
write_prototypes(ostream &out,ostream *out_h) {
|
||||
// The 'used' attribute prevents emscripten from optimizing it out.
|
||||
out <<
|
||||
"#if __GNUC__ >= 4\n"
|
||||
"#define EXPORT_FUNC extern \"C\" __attribute__((used, visibility(\"default\")))\n"
|
||||
"#else\n"
|
||||
"#define EXPORT_FUNC extern \"C\"\n"
|
||||
"#endif\n\n";
|
||||
|
||||
FunctionsByIndex::iterator fi;
|
||||
for (fi = _functions.begin(); fi != _functions.end(); ++fi) {
|
||||
Function *func = (*fi).second;
|
||||
@ -140,8 +148,13 @@ write_prototype_for(ostream &out, InterfaceMaker::Function *func) {
|
||||
|
||||
for (ri = func->_remaps.begin(); ri != func->_remaps.end(); ++ri) {
|
||||
FunctionRemap *remap = (*ri);
|
||||
|
||||
if (remap->_extension || (remap->_flags & FunctionRemap::F_explicit_self)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (output_function_names) {
|
||||
out << "extern \"C\" ";
|
||||
out << "EXPORT_FUNC ";
|
||||
}
|
||||
write_function_header(out, func, remap, false);
|
||||
out << ";\n";
|
||||
@ -216,10 +229,6 @@ write_function_instance(ostream &out, InterfaceMaker::Function *func,
|
||||
void InterfaceMakerC::
|
||||
write_function_header(ostream &out, InterfaceMaker::Function *func,
|
||||
FunctionRemap *remap, bool newline) {
|
||||
if (remap->_extension || (remap->_flags & FunctionRemap::F_explicit_self)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (remap->_void_return) {
|
||||
out << "void";
|
||||
} else {
|
||||
|
@ -1499,6 +1499,8 @@ write_module(ostream &out, ostream *out_h, InterrogateModuleDef *def) {
|
||||
<< "\n"
|
||||
<< "#ifdef _WIN32\n"
|
||||
<< "extern \"C\" __declspec(dllexport) PyObject *PyInit_" << def->module_name << "();\n"
|
||||
<< "#elif __GNUC__ >= 4\n"
|
||||
<< "extern \"C\" __attribute__((visibility(\"default\"))) PyInit_" << def->module_name << "();\n"
|
||||
<< "#else\n"
|
||||
<< "extern \"C\" PyObject *PyInit_" << def->module_name << "();\n"
|
||||
<< "#endif\n"
|
||||
@ -1512,6 +1514,8 @@ write_module(ostream &out, ostream *out_h, InterrogateModuleDef *def) {
|
||||
<< "\n"
|
||||
<< "#ifdef _WIN32\n"
|
||||
<< "extern \"C\" __declspec(dllexport) void init" << def->module_name << "();\n"
|
||||
<< "#elif __GNUC__ >= 4\n"
|
||||
<< "extern \"C\" __attribute__((visibility(\"default\"))) init" << def->module_name << "();\n"
|
||||
<< "#else\n"
|
||||
<< "extern \"C\" void init" << def->module_name << "();\n"
|
||||
<< "#endif\n"
|
||||
|
@ -136,6 +136,8 @@ write_module(ostream &out,ostream *out_h, InterrogateModuleDef *def) {
|
||||
|
||||
<< "#ifdef _WIN32\n"
|
||||
<< "extern \"C\" __declspec(dllexport) INIT_FUNC();\n"
|
||||
<< "#elif __GNUC__ >= 4\n"
|
||||
<< "extern \"C\" __attribute__((visibility(\"default\"))) INIT_FUNC();\n"
|
||||
<< "#else\n"
|
||||
<< "extern \"C\" INIT_FUNC();\n"
|
||||
<< "#endif\n\n"
|
||||
|
@ -123,6 +123,8 @@ write_module(ostream &out,ostream *out_h, InterrogateModuleDef *def) {
|
||||
|
||||
<< "#ifdef _WIN32\n"
|
||||
<< "extern \"C\" __declspec(dllexport) INIT_FUNC();\n"
|
||||
<< "#elif __GNUC__ >= 4\n"
|
||||
<< "extern \"C\" __attribute__((visibility(\"default\"))) INIT_FUNC();\n"
|
||||
<< "#else\n"
|
||||
<< "extern \"C\" INIT_FUNC();\n"
|
||||
<< "#endif\n\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user