Suggestions for runtime C++ compilation? [closed]

  c++

I am needing to compile + execute C++ code at runtime, and am looking for the best way to do this.
Constraints:

  • The application needs to be deployed to users machines that will not have a C++ compiler installed
  • Needs to run on Linux, Windows, and Mac

Because of these constraints, a number of easy options are not possible.
eg

  • All runtime-compiling resources I’ve found (eg blogs etc…) suggest writing a .cpp file to disk and invoking a native compiler. But given my application needs to run on a users machine, I cannot rely on a compiler being installed.
  • SYCL is not possible given that Mac does not support OpenCL. There are a number of SYCL implementations (eg hipSYCL) that support generating code to run on MacOS hardware, but they require a native C++ compiler to be installed.

An ideal solution would be something similar to NVRTC (https://docs.nvidia.com/cuda/nvrtc/index.html)
NVRTC is a runtime interface to nvidias CUDA compiler, which is a single DLL and provides an interface to compile + run (via cuda) arbitrary C++ code at runtime.

Thoughts?
Thanks!

Source: Windows Questions C++

LEAVE A COMMENT