nodejs / nodejs/node

Support loading dynamic addon modules (`.node` files) when embedding the Node.js shared library without needing to link with `node.def`

オープン
#52,282 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

feature request
主要言語
JavaScript
スター
122k
フォーク
37.3k
平均マージ
4日 2時間
マージ済み PR(30日)
283

説明

What is the problem this feature will solve?

Node.js addon modules on Windows current import from the node.exe executable, when you build Node.js as a shared library, it reexports all the needed symbols from the node shared library from the executable using a generated node.def file.

If you embed the Node.js shared library into a different executable/program, for loading such addon modules to work, that executable will need to be linked with node.def to reexport the needed symbols.

node-gyp also adds win_delay_load_hook.cc to addons on Windows to make them work when the Node.js executable is renamed.

What is the feature you are proposing to solve the problem?

Maybe we can support loading such addon modules without this requirement?

For example, what if the delay load hook looked for an env var (e.g. NODE_LIBRARY) that it would then pass to GetModuleHandle instead of NULL if it is set, and when Node.js is built as a shared library, it would set this env var before dynamically loading a module?

Though I'm not sure what security implications such a mechanism may have...

What alternatives have you considered?

No response

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

node-gyp の win_delay_load_hook.cc と、issue で説明されている Node.js の共有ライブラリ読み込みパス(node.def と GetModuleHandle を含む)から始めます。埋め込みプログラムが node.def にリンクせずに .node モジュールを読み込める、サポート対象のメカニズムを特定し、セキュリティ動作を定義します。Windows 上の埋め込み Node.js で、名前を変更した実行可能ファイルを壊すことなく動作すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, node.js
領域
operating-systems
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
説明が足りない
初心者へのやさしさ
32/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。