diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2012-12-18 09:56:57 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-12-18 16:07:31 +0100 |
commit | 8ccfed2edceb9b4c216ce885d76fa03537e3eb5e (patch) | |
tree | 14905b86a6ed1f5b709b65a01a35bb7b6cd2cb49 | |
parent | 7b2ef2de208130f6cfe4775357eae0290a621653 (diff) | |
download | node-8ccfed2edceb9b4c216ce885d76fa03537e3eb5e.tar.gz |
node: s/-/_/ in add-on symbol name
Replace dashes with underscores. When loading foo-bar.node, look for
foo_bar_module, not foo-bar_module. The latter is not a legal symbol name.
-rw-r--r-- | src/node.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/node.cc b/src/node.cc index a74d80e6f..6341ec3f7 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1933,6 +1933,13 @@ Handle<Value> DLOpen(const v8::Arguments& args) { return ThrowException(exception); } + /* Replace dashes with underscores. When loading foo-bar.node, + * look for foo_bar_module, not foo-bar_module. + */ + for (pos = symbol; *pos != '\0'; ++pos) { + if (*pos == '-') *pos = '_'; + } + node_module_struct *mod; if (uv_dlsym(&lib, symbol, reinterpret_cast<void**>(&mod))) { char errmsg[1024]; |