Search code examples
compilationincludequickjs

QuickJS Translate a Module Created with JS to C and Use it as a Builtin Module


I read this article: Writing native modules in C for QuickJS engine .

But I can write the module faster and easier with JS. After creating the module, I can use import:

import myModule from "./myModule.js";

But I don't want to move the module everywhere. Instead I want to use qjsc to convert the code to myModule.c or myModule.o first and then compile qjs and use it as a builtin module.

My expectation is to convert the js code to c with qjsc and then make qjs to include it in qjs, just like the std and os modules in QuickJS.


Solution

  • We discussed the issue here: saghul/txiki.js#386