Skip to content

Commit

Permalink
src: add default visibility to NODE_MODULE
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bnoordhuis authored and indutny committed Mar 5, 2014
1 parent 6eb4d1d commit bd8a575
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ node_module_struct* get_builtin_module(const char *name);
#ifdef _WIN32
# define NODE_MODULE_EXPORT __declspec(dllexport)
#else
# define NODE_MODULE_EXPORT /* empty */
# define NODE_MODULE_EXPORT __attribute__((visibility("default")))
#endif

#define NODE_MODULE(modname, regfunc) \
Expand Down

0 comments on commit bd8a575

Please sign in to comment.