-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Make native module rerequirable. #5016
Comments
@waaaagit so you're wanting to be able to unload compiled native addons just like you can do with the I guess this means using |
Actually, I wanting make native module rerequirable, not unload native module. Because I use node's multi context feature. If a native module loaded in a context, it can't load by other context :( I think this is not just a feature request, but also a bug for multi context feature. |
OK, so this in src/node.cc is probably relevant:
|
Well, node has been supporting multi-context feature for a long time. I hope node embedders don't need to wait too long for this bug fix :) |
There are two pieces to this issue. One is loading and unloading of shared objects in a multi-context environment, the other is making add-ons multi-context aware.
(Some dynamic linkers support loading a shared object more than once at different addresses. But it's not portable and won't help if the global state is something like a log file.) Apropos core support, a |
+1 |
You can see some of the pain caused by this looking at: request/request-promise#89 |
A summary of why this change was required is discussed in the following issues: jestjs/jest#3552 jestjs/jest#3550 nodejs/node#5016
Discussion on why this change was required can be found in the following issues: jestjs/jest#3552 jestjs/jest#3550 nodejs/node#5016
Discussion on why this change was required can be found in the following issues: jestjs/jest#3552 jestjs/jest#3550 nodejs/node#5016
Discussion on why this change was required can be found in the following issues: jestjs/jest#3552 jestjs/jest#3550 nodejs/node#5016
Put into https://github.com/nodejs/node/projects/13 backlog |
I'm a node embedder, using node v4.2.4
In my situation,
sometimes, I need to unrequire module.(Which I delete module cache in require.cache).
sometimes, I need to refresh the global object to clean the symbol.
In those case,
the .node library probably loaded before. after unrequire module or refresh global object, I got error like 'non self-register'.
The pure JS module and the buildin module are FINE.
Simple test code:
The text was updated successfully, but these errors were encountered: