6

Is it possible to call a JavaScript function (written over, say, node.js) from C?

(There are plenty of tutorials on calling C/C++ from node.js. But not the other way around.)

George
  • 6,369
  • 2
  • 28
  • 61

1 Answers1

-1

You could use Emscripten.

Emscripten is an LLVM-to-JavaScript compiler.

It takes LLVM bitcode - which can be generated from C/C++, using llvm-gcc (DragonEgg) or clang, or any other language that can be converted into LLVM - and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run).

Also see this: How to execute Javascript function in C++

Community
  • 1
  • 1
sg7
  • 5,668
  • 2
  • 31
  • 39
  • 3
    While I am not the asker, this almost certainly does not answer his question. –  Mar 19 '19 at 20:45