我可以使用clang在内存源代码中编译为可执行文件吗?

时间:2014-02-17 22:14:16

标签: clang

阅读此链接:http://fdiv.net/2012/08/15/compiling-code-clang-api 我看到我可以加载c / c ++文件并将其编译为可执行文件。
但如果我在c / c ++中有某种源代码,我就找不到任何信息 我的应用程序生成或其他方式..
总之,我可以通过我加载c文件的阶段,并只是构建我自己的逻辑编译成可执行文件?

1 个答案:

答案 0 :(得分:3)

当然可以。并且已经有一个项目用于此目的 根据您的意愿挖掘其源代码:)
Cling

What is Cling

Cling is an interactive C++ interpreter, built on the top of   
LLVM and Clang libraries. Its advantages over the standard  
interpreters are that it has command line prompt and uses  
just-in-time (JIT) compiler for compilation. Many of the developers  
(e.g. Mono in their project called CSharpRepl) of such kind 
of software applications name them interactive compilers.

One of Cling's main goals is to provide contemporary, high-performance  
alternative of the current C++ interpreter in the ROOT project -  
CINT. The backward-compatibility with CINT is major priority during  
the development.