Compilation from memory


Is clang able to compile C code from a memory location, instead of from a file ?
I would like to do like so:

but from a memory pointer (so I would write a char array with the includes and the code and give it to clang) in a running application.



Yes. Look at libtooling.


cannot libclang do the same ?
My code is in C and I cannot afford c++ this time…

Yes, this is also possible with libclang. You use the CXUnsavedFile struct when calling clang_parseTranslationUnit.