-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No N-API equivalent for new well-known-symbol loading feature #19845
Comments
Does this make sense for N-API? After all, it is supposed to be ABI-stable, so it doesn't need |
@addaleax with this change, if you call Fundamentally, if a plain V8 native addon fails to register, it will still have its |
@addaleax I guess the fundamental new feature here is that we now have a tool for finding a symbol given a library handle in a way that is supported across all Node.js platforms. One of my first thoughts is that we may want to for (size_t version = NAPI_VERSION; version > 0; version--) {
void *symbol = dlib->GetSymbolAddress((
std::string("napi") +
std::to_string(version) +
"_register_module").c_str());
if (symbol != nullptr) {
// Initialize the N-API module
}
} Some outstanding questions:
|
Also, #19731 may render this moot, since it allows the re-loading of modules without any special symbol. I just hope we can address all the edge cases of shared library loading in that PR. |
Much like regular modules, N-API modules can also benefit from having a special symbol which they can expose. Fixes: nodejs#19845
@bnoordhuis adds support for loading a module by looking for a well-known symbol if the module fails to self-register in 3828fc6. The new code looks for a symbol that matches the
NODE_MODULE_VERSION
(node_register_module_${NODE_MODULE_VERSION}
).We need to extend this approach to N-API modules as well.
The text was updated successfully, but these errors were encountered: