有没有可直接嵌入到C / C ++程序中的C / C ++编译器/链接器? [英] Is there a C/C++ compiler/linker which is embedable directly in a C/C++ program?
问题描述
这个想法是在运行时生成C / C ++代码,将其编译为共享对象,并在当前进程中加载该共享对象。
The idea is to generate C/C++ code at run-time, compile it to a shared object, and load that shared object in the current process.
知道它可以通过使用主机平台(GCC或MSVC)上的现有编译器安装来完成,但是在实际情况下,客户端不需要这样的安装。所以想法是静态链接这样的编译器和链接器。
I know it could be done by using an existing compiler installation on the host platform (GCC or MSVC), but in a practical scenario the client don't necessary have such installation. So the idea is to statically link with such compiler and linker.
例如在Java中,你可以直接从java代码编译.java类。它可以用于从数据库模式自动生成一个Buisness对象。
For example in Java, you can compile .java classes directly from java code. It can be used to generate automatically a Buisness Objects from a database schema.
推荐答案
您可以使用c - 语言前端( clang )至 llvm 。构建在clang之上的静态分析器可能会提供一些有关如何继续操作的建议。
You may be able to do this with the c-language front end (clang) to llvm. The static analyzer built on top of clang may give you some ideas on how to proceed.
这篇关于有没有可直接嵌入到C / C ++程序中的C / C ++编译器/链接器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!