Skip to content

process.versions.modules is not for N-API ? #2328

@linxiaowu66

Description

@linxiaowu66
  • Node.js Version: 13.2.0
  • OS: Mac
  • Scope (install, code, runtime, meta, other?): code
  • Module (and version) (if relevant): N-API
    Hi guys, I have a problem about the global variable : process.versions.modules.

In the docs of nodejs, it describe the process.versions.modules as follow:

process.versions.modules indicates the current ABI version, which is increased whenever a C++ API changes. Node.js will refuse to load modules that were compiled against a different module ABI version.

So with this description, I think if I have a C++ addon with N-API build in the node v8(modules: '57'), and then use it the node v13(modules: '79'), it will throw error. But actually it does not.

And I read the nodejs source code, in the DLOpen function , I find this if statements:

// -1 is used for N-API modules
    if ((mp->nm_version != -1) && (mp->nm_version != NODE_MODULE_VERSION)) {}

as the comments, if this module is not N-API, so nodejs will compare the module version to current module version, if these two version is not the same, it will report error.

Now I am confusing with this code. versions.modules is not for N-API ?

Can anyone help me ?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions