简体   繁体   English

从本机C / C ++生成并运行LLVM代码

[英]Generate and run LLVM code from native C/C++

Is it possible to do these things from a native C or C++ -compiled program (gcc): 是否可以通过本机CC++编译程序(gcc)执行以下操作:

  1. Call clang and compile given C code of a function, passed as const char * . 调用clang并编译以const char *传递的函数的给定C代码。
  2. Obtain a pointer and run it in the LLVM virtual machine. 获取一个指针并在LLVM虚拟机中运行它。
  3. Acquire the result in the native program and continue. 在本机程序中获取结果并继续。

How? 怎么样?

For a minimalistic example, see Clang interpreter . 有关简约的示例,请参见Clang解释器

Cling is bit more practical example of such an approach. Cling是这种方法更实际的示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM