Skip to content

metacall/nodejs-cpp-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MetaCall NodeJS C/C++ Example

An example of using C and C++ libraries from NodeJS by using MetaCall.

This example shows few capabilities:

  1. Loading C code from a .c file directly into NodeJS.
  2. Loading C++ code from a .h file and a compiled library .so. At the time of writting, MetaCall does not support loading .cpp files so your library must be compiled with a C/C++ compiler and the functions must be exported with C ABI, then it can be loaded into MetaCall. We support custom Rust ABI and we plan to support C++ ABI in the future, but it's not yet implemented.

For demonstrating the lastest feature implemented on MetaCall[1][2], we will run the examples with node binary instead of metacall. This will provide full portability and removing the need of using MetaCall CLI for launching the scripts.

The idea is showing different ways to achieve the same objective, interop MetaCall with C/C++. The example is implemented by using Docker so it is fully reproducible, and CMake for building the C++ library.

About

An example of using C and C++ libraries from NodeJS by using MetaCall.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published