clang: compile c code from char array?

Hi, how do I compile c code from a char array in clang?

Im using code from the interpreter example.

char *cCode; // the char array
// fill array with code goes here...

// Initialize a compiler invocation object from the clang (-cc1) arguments.
  const driver::ArgStringList &CCArgs = Cmd->getArguments();
  llvm::OwningPtr<CompilerInvocation> CI(new CompilerInvocation);
                                     const_cast<const char
                                     const_cast<const char
**>( +

  // Show the invocation, with -v.
  if (CI->getHeaderSearchOpts().Verbose) {
    llvm::errs() << "clang invocation:\n";
    C->PrintJob(llvm::errs(), C->getJobs(), "\n", true);
    llvm::errs() << "\n";

This thread may help:

no, does not help, ive already looked at it.

none none-17 wrote:

I don't know how ccons works, but it may do what you need.

ummm close but no, plus I think it uses an old version of llvm, theres files
thats not in latest version.

Jean-Daniel Dupas-2 wrote: