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.
pull/24504/head
Ben Noordhuis 2012-12-18 09:56:57 +01:00
parent 7b2ef2de20
commit 8ccfed2edc
1 changed files with 7 additions and 0 deletions

View File

@ -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];