Skip to content

Commit bd8a575

Browse files
bnoordhuisindutny
authored andcommitted
src: add default visibility to NODE_MODULE
It's currently not really possible to compile native add-ons with -fvisibility=hidden because that also hides the struct containing the module definition. The NODE_MODULE() and NODE_MODULE_DECL() macros are structured in a way that makes it impossible to add a visibility attribute manually so there is no escape hatch there. That's why this commit adds an explicit visibility attribute to the module definition. It doesn't help with node.js releases that are already out there but at least it improves the situation going forward.
1 parent 6eb4d1d commit bd8a575

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ node_module_struct* get_builtin_module(const char *name);
217217
#ifdef _WIN32
218218
# define NODE_MODULE_EXPORT __declspec(dllexport)
219219
#else
220-
# define NODE_MODULE_EXPORT /* empty */
220+
# define NODE_MODULE_EXPORT __attribute__((visibility("default")))
221221
#endif
222222

223223
#define NODE_MODULE(modname, regfunc) \

0 commit comments

Comments
 (0)