Search code examples
c++boostdynamicstandard-libraryruntime-compilation

Is there Something in the Standard Library or Boost to Compile a dll at Runtime?


In C# I can use CSharpCodeProvider to take in a file and compile it on the fly.

I want the same thing for C++. Essentially I'm trying to compile a .dll from a file specified at runtime and dynamically link it to the executing program.

I'm sure there's some crazy library out there that does this, but what I was hoping is that there is a library in either the Standard Library or Boost which does this. Does anyone know of one?


Solution

  • No, there is nothing like this in the standard library or boost.

    There is however clang which is a full C++ compiler built on LLVM which is organized as a library that you can (with "some" work) use in your program.

    @Perreal also pointed out correctly that if you are using C++/CLI (which is usually not included when talking about C++ in general), you can access a .NET component that will allow you to compile C++/CLI code - but not native C++ code.