Skip to content

Eventually switch node-osrm to Node.js's ABI stable N-API #4118

@daniel-j-h

Description

@daniel-j-h

Node.js's upcoming LTS is the first to provide a stable ABI for building native addons against. It's basically an ABI stable C interface around the existing Node.js API with backwards compatibility guarantees.

On top of the stable C ABI there is a header-only C++ wrapper which is more or less NAN with some minor differences (it's not completely a drop-in replacement).

I'm doing the same pattern for https://github.com/scanse/sweep-sdk and it's great for ABI compatibility. In the stable ABI you only expose symbols you can and have to guarantee stability for. Build your library once run it everywhere and link against new libraries without ABI issues.

It probably makes sense for us to switch to Node.js's stable N-API eventually: build the node-osrm addon once and have it running against all Node.js versions to come. The N-API is supported from the upcoming LTS on only - switching now already is neither possible nor desired (we have to support the current LTS).

As usual: needs to be benchmarked - will introduce a small ABI / API boundary.

References:

cc @miccolis @kkaefer @springmeyer maybe interesting for you

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions