mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 09:52:27 -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::
|
void InterfaceMakerC::
|
||||||
write_prototypes(ostream &out,ostream *out_h) {
|
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;
|
FunctionsByIndex::iterator fi;
|
||||||
for (fi = _functions.begin(); fi != _functions.end(); ++fi) {
|
for (fi = _functions.begin(); fi != _functions.end(); ++fi) {
|
||||||
Function *func = (*fi).second;
|
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) {
|
for (ri = func->_remaps.begin(); ri != func->_remaps.end(); ++ri) {
|
||||||
FunctionRemap *remap = (*ri);
|
FunctionRemap *remap = (*ri);
|
||||||
|
|
||||||
|
if (remap->_extension || (remap->_flags & FunctionRemap::F_explicit_self)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (output_function_names) {
|
if (output_function_names) {
|
||||||
out << "extern \"C\" ";
|
out << "EXPORT_FUNC ";
|
||||||
}
|
}
|
||||||
write_function_header(out, func, remap, false);
|
write_function_header(out, func, remap, false);
|
||||||
out << ";\n";
|
out << ";\n";
|
||||||
@ -216,10 +229,6 @@ write_function_instance(ostream &out, InterfaceMaker::Function *func,
|
|||||||
void InterfaceMakerC::
|
void InterfaceMakerC::
|
||||||
write_function_header(ostream &out, InterfaceMaker::Function *func,
|
write_function_header(ostream &out, InterfaceMaker::Function *func,
|
||||||
FunctionRemap *remap, bool newline) {
|
FunctionRemap *remap, bool newline) {
|
||||||
if (remap->_extension || (remap->_flags & FunctionRemap::F_explicit_self)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (remap->_void_return) {
|
if (remap->_void_return) {
|
||||||
out << "void";
|
out << "void";
|
||||||
} else {
|
} else {
|
||||||
|
@ -1499,6 +1499,8 @@ write_module(ostream &out, ostream *out_h, InterrogateModuleDef *def) {
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "#ifdef _WIN32\n"
|
<< "#ifdef _WIN32\n"
|
||||||
<< "extern \"C\" __declspec(dllexport) PyObject *PyInit_" << def->module_name << "();\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"
|
<< "#else\n"
|
||||||
<< "extern \"C\" PyObject *PyInit_" << def->module_name << "();\n"
|
<< "extern \"C\" PyObject *PyInit_" << def->module_name << "();\n"
|
||||||
<< "#endif\n"
|
<< "#endif\n"
|
||||||
@ -1512,6 +1514,8 @@ write_module(ostream &out, ostream *out_h, InterrogateModuleDef *def) {
|
|||||||
<< "\n"
|
<< "\n"
|
||||||
<< "#ifdef _WIN32\n"
|
<< "#ifdef _WIN32\n"
|
||||||
<< "extern \"C\" __declspec(dllexport) void init" << def->module_name << "();\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"
|
<< "#else\n"
|
||||||
<< "extern \"C\" void init" << def->module_name << "();\n"
|
<< "extern \"C\" void init" << def->module_name << "();\n"
|
||||||
<< "#endif\n"
|
<< "#endif\n"
|
||||||
|
@ -136,6 +136,8 @@ write_module(ostream &out,ostream *out_h, InterrogateModuleDef *def) {
|
|||||||
|
|
||||||
<< "#ifdef _WIN32\n"
|
<< "#ifdef _WIN32\n"
|
||||||
<< "extern \"C\" __declspec(dllexport) INIT_FUNC();\n"
|
<< "extern \"C\" __declspec(dllexport) INIT_FUNC();\n"
|
||||||
|
<< "#elif __GNUC__ >= 4\n"
|
||||||
|
<< "extern \"C\" __attribute__((visibility(\"default\"))) INIT_FUNC();\n"
|
||||||
<< "#else\n"
|
<< "#else\n"
|
||||||
<< "extern \"C\" INIT_FUNC();\n"
|
<< "extern \"C\" INIT_FUNC();\n"
|
||||||
<< "#endif\n\n"
|
<< "#endif\n\n"
|
||||||
|
@ -123,6 +123,8 @@ write_module(ostream &out,ostream *out_h, InterrogateModuleDef *def) {
|
|||||||
|
|
||||||
<< "#ifdef _WIN32\n"
|
<< "#ifdef _WIN32\n"
|
||||||
<< "extern \"C\" __declspec(dllexport) INIT_FUNC();\n"
|
<< "extern \"C\" __declspec(dllexport) INIT_FUNC();\n"
|
||||||
|
<< "#elif __GNUC__ >= 4\n"
|
||||||
|
<< "extern \"C\" __attribute__((visibility(\"default\"))) INIT_FUNC();\n"
|
||||||
<< "#else\n"
|
<< "#else\n"
|
||||||
<< "extern \"C\" INIT_FUNC();\n"
|
<< "extern \"C\" INIT_FUNC();\n"
|
||||||
<< "#endif\n\n"
|
<< "#endif\n\n"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user