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.
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
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:> > 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 > > > > > > _______________________________________________ > 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--tp29439679p29447283.html Sent from the LLVM - Dev mailing list archive at Nabble.com.