anael-seghezzi / CToy

Interactive C live coding environment
Other
1.32k stars 70 forks source link

Added an API for retrieving the argv and argc #11

Closed Smilex closed 6 years ago

Smilex commented 6 years ago

It keeps the copy operation as it was and now has the API you suggested

anael-seghezzi commented 6 years ago

Hi, looks good.

I don't see why you have to allocate and copy memory from argv. All CToy callbacks originate from the main function so you can just copy the pointer of argv. ctoyargc = argc; ctoyargv = argv;

ps: These two lines should also be added to ctoy_native.c

Smilex commented 6 years ago

It just made a lot of sense at the time that argv wouldn't persist, but I'm not thinking hard about any of this, I'm trying to be fast. Although I don't understand all the details of argv, I see now that it makes no sense to copy it.

I don't have a ctoy_native.c?

anael-seghezzi commented 6 years ago

ctoy_native is there https://github.com/anael-seghezzi/CToy/tree/master/ressources/tool/build_native/src (it's a part of the tool that allow to compile in native with an optimized compiler like gcc)