[cfe-dev] clang: doing without argv, argv + argc, hard wire?
Paul Griffiths
gafferuk at gmail.com
Wed Aug 18 23:48:15 PDT 2010
Ive hard wired it with:
int argc = 2;
char argv[2][MAX_PATH];
if(0 != GetModuleFileName(0, argv[0], MAX_PATH))
strcpy(argv[1], "file.c");
It works ok, but is there a "Proper Way?"
On 18 August 2010 22:06, Paul Griffiths <gafferuk at gmail.com> wrote:
> Too be honist I would like to supply the c code to be called by the
> JIT in a char array or std::string.
> Has anyone any code?
>
> On 18 August 2010 22:02, Paul Griffiths <gafferuk at gmail.com> wrote:
>> im using clang, and my project is based on interpreter example. I
>> don't want to supply the c-code file path from the command line, so
>> don't want to use argv, argv + argc.
>>
>> in the interpreter example the line:
>>
>> llvm::sys::Path Path = GetExecutablePath(argv[0]);
>>
>> I presume I can hard wire that to for example :
>>
>> llvm::sys::Path Path = GetExecutablePath("MyFile.c");
>>
>> but, what do I do for:
>>
>> llvm::SmallVector<const char *, 16> Args(argv, argv + argc);
>> Args.push_back("-fsyntax-only");
>> llvm::OwningPtr<Compilation> C(TheDriver.BuildCompilation(Args.size(),
>> Args.data()));
>>
>> Can I do without argv, argv + argc? can I hard wire these too?
>>
>> Any ideas?
>>
>
More information about the cfe-dev
mailing list