[LLVMdev] clang: compile c code from char array?
Jean-Daniel Dupas
devlists at shadowlab.org
Sun Aug 15 08:50:49 PDT 2010
I don't know how ccons works, but it may do what you need.
http://code.google.com/p/ccons/
Le 15 août 2010 à 14:48, gafferuk a écrit :
>
> no, does not help, ive already looked at it.
>
>
>
> none none-17 wrote:
>>
>> This thread may help:
>> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-June/009507.html
>>
>> On Sun, Aug 15, 2010 at 2:50 AM, gafferuk <gafferuk at gmail.com> wrote:
>>
>>>
>>> Hi, how do I compile c code from a char array in clang?
>>>
>>> Im using code from the interpreter example.
>>> Thanks.
>>>
>>> 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);
>>> CompilerInvocation::CreateFromArgs(*CI,
>>> const_cast<const char
>>> **>(CCArgs.data()),
>>> const_cast<const char
>>> **>(CCArgs.data()) +
>>> CCArgs.size(),
>>> Diags);
>>>
>>> // 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";
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/clang%3A-compile-c-code-from-char-array--tp29439679p29439679.html
>>> Sent from the LLVM - Dev mailing list archive at Nabble.com.
>>>
>>> _______________________________________________
>>> LLVM Developers mailing list
>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>
> --
> View this message in context: http://old.nabble.com/clang%3A-compile-c-code-from-char-array--tp29439679p29442243.html
> Sent from the LLVM - Dev mailing list archive at Nabble.com.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
-- Jean-Daniel
More information about the llvm-dev
mailing list