How to run c++ code from c++?

前端 未结 5 1630
夕颜
夕颜 2021-01-24 02:03

If I have some c++ code as a string quantity (data) in a c++ program, can I execute the contents of that string?

As using the CodeDOM in C# or the eval function present

5条回答
  •  無奈伤痛
    2021-01-24 02:14

    Non of the mainstream C++ implementations have that feature, as C++ is not reflective.

    However, take a look at Ch, it might be what you are looking for:

    http://www.softintegration.com/

    http://en.wikipedia.org/wiki/Ch_interpreter

    You can embed Ch interpreter into your C++ application and run dynamic C++ code inside it.

提交回复
热议问题