Building native add-ons

Open Enterprise SDK for Node.js supports native add-ons, which loads dynamically linked shared objects that are written in C/C++ or PL/I into your Node.js applications. With this ability, you are no longer confined to what you can write with JavaScript and Node.js APIs, but can extend your applications to tap existing native drivers, libraries, services, and so on.

Note: Before building native add-ons, ensure the prerequisites for building native add-ons are met.
You can build or install native add-on packages with the following commands:
$ npm install .                # To build in package directory
$ npm install <package name>   # To install the specified package from npmjs

Building C/C++ native add-ons

You can use the IBM® C/C++ for Open Enterprise Languages on z/OS® 2.0 compiler to build C/C++ native add-ons. The compiler supports 64-bit compilation mode only and supports up to C17/C18 and C++17 language standard features. The compiler can be invoked by using the clang invocation command to compile and link C programs or modules and the clang++ invocation command to compile and link C++ programs or modules.

Building PL/I native add-ons

PL/I source files with the .pli extension can be added to the sources section of the node-gyp binding.gyp file. For example,
"sources": [ "plibinding.cc", "num.pli" ]

PL/I source files that are specified in such a way are automatically compiled and linked, similar to C/C++ source files.

node-gyp assumes the Enterprise PL/I for z/OS compiler, specifically, the PLI compiler command. To override this, you can export the PLI environment variable to point to the PL/I compiler of your choice.

Related reference