Skip to content
This repository was archived by the owner on Mar 29, 2026. It is now read-only.

andruhon/rust-in-node-cpp-back-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust in node examples

Work still in progress

Experimenting with adding C++ lib back to Rust extension for NodeJS addon.

What's inside:

  • C++ static library ./lib/mylib.cc
  • Rust dynamic library in ./src/embed.rs (linked with mylib.cc)
  • Native NodeJS C++ addon ./src/addon.cc using ./src/embed.rs library

See more general Rust in node examples here: https://github.com/andruhon/rust-in-node-examples

Installation

> npm install > npm run build

Running

> node index.js

Why

On windows it is not really possible to embed node extensions compiled with GCC back into NodeJS, because NodeJS for Windows is compiled with MSVC and addons should be compiled and linked with MSVC as well. So it is not possible to use custom build script which uses gcc crate for ths purpose.

TODO

  • Tests
  • More docs

Links

About

Include C++ static library from rust library for C++ node extension

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors