Replies: 1 comment 4 replies
-
|
The problem I'm facing may be rather niche, so I'm not sure if it can be regarded as a general issue. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In some cases, it is inevitable to have both
weak-node-apiand other NAPI implementations coexist within a single process space. For example:In Electron-like frameworks, both Node.js NAPI and
weak-node-apiare present simultaneously;In HarmonyOS, both OpenHarmony NAPI and
weak-node-apicoexist in the same process.Does anyone have good ideas on how to resolve this symbol conflict issue🤔?
One approach is to rename the symbols of
weak-node-apiby adding a specific suffix (e.g.,_weak—we'll use this suffix as an example below) to avoid symbol conflicts.If we adopt the symbol renaming solution, how to quickly rename all symbols of weak-node-api is also a topic worthy of discussion. One method is to include a header file with macro definitions at the beginning of code files, which renames symbols during the preprocessing stage. Of course, an "undefine" header file is also needed to cancel these macros at the end of the code header files, preventing impacts on other code. Here are some examples:
By the way, if the PR at nodejs/node#60916 is merged into Node.js in the future, NAPI will no longer need to expose numerous napi_xxx-series symbols—and thus, the symbol conflict issue will naturally be resolved. However, for the time being, we still have to tackle this problem head-on.
Beta Was this translation helpful? Give feedback.
All reactions