[llvm-dev] How to pass arbitrary arguments to runFunctionAsMain? (original) (raw)

Alberto Barbaro via llvm-dev llvm-dev at lists.llvm.org
Sat Jan 26 00:33:24 PST 2019


Hi Tim, Thanks for your answer. I'll fix the problem with envp now.

I don't know if you have seen my other question but i was doubting of that code because I cannot get the proper value of argv at runtime using my Interpreter. I hope this is the problem. Do you think the same?

Thanks again

On Sat, Jan 26, 2019, 08:22 Tim Northover <t.p.northover at gmail.com wrote:

On Sat, 26 Jan 2019 at 07:44, Alberto Barbaro via llvm-dev <llvm-dev at lists.llvm.org> wrote: > const char* const* envp; > [...] > v->runFunctionAsMain(main, parameters, envp);

envp remains uninitialized here, and runFunctionAsMain appears to iterate through it until it reaches a nullptr, so that'll probably crash. I think you want const char* const* envp = {nullptr}; Other than that, it looked sensible to me. Cheers. Tim. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190126/23e4e9de/attachment.html>



More information about the llvm-dev mailing list