nodejs / nodejs/node

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

Offen
#52,282 10 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

feature request
Vorherrschende Sprache
JavaScript
Sterne
122k
Forks
37.3k
Ø Merge
4 T. 2 Std.
Gemergte PRs (30 T.)
283

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit node-gyp's win_delay_load_hook.cc und dem im Issue beschriebenen Ladepfad für gemeinsam genutzte Bibliotheken von Node.js, einschließlich node.def und GetModuleHandle. Ermittle einen unterstützten Mechanismus, mit dem eingebettete Programme .node-Module laden können, ohne node.def zu verlinken, und definiere das Sicherheitsverhalten; abgeschlossen ist die Aufgabe, wenn dies für eingebettetes Node.js unter Windows funktioniert, ohne umbenannte ausführbare Dateien zu beeinträchtigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, node.js
Bereich
operating-systems
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Ruhig
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
32/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.