Well, it doesn't matter how you try to execute execl, that function doesn't exist as far as the compiler can tell. You were right to include unistd.h. When I type "man execl" it says it's included in unistd.h. However, apparently that's not enough. I did a grep on the devkitpro files and got this:
Code:
/opt/devkitPro/devkitPPC/powerpc-gekko/include/sys/unistd.h:43:intÂÂÂÂ _EXFUN(execl, (const char *__path, const char *, ... ));
/opt/devkitPro/devkitPPC/powerpc-gekko/include/process.h:10:int execl(const char *path, const char *argv0, ...);
I would try either #include or #include .
If you're still getting undefined reference, or it still doesn't work, LoadMii is an advanced OSS loader you can look at. I checked their source, but there's no calls to exec() or it's family. Instead they have their own function,
one for dols and one for elfs. This copies the dol to the proper space in memory and then copies the passed arguments to the proper space in memory, as well. If you take a look at loadmii's
main.c, you should be able to see how it sets up the __argv structure and loads arguments into it. You'll also note that load_dol() doesn't execut, it just loads it and returns the address in memory it's stored at. Some other function near the end of main actually uses that addrss to launch the app.
This is less straight forward than exec, but it's possible that was never ported as the wii doesn't run a proper OS, just a kernel. I can't find documentation or a declaration for the __argv structure easily, suffice to say it's buried somewhere in libogc or the standard c libraries and you won't need to include anything more than dol.c includes. Look at what LoadMii does. You can strip out a lot of the code you don't need and just get the basics. Something like ... Load dol file with fopen into memory buffer. Do something with an __argv args[] array to setup your args you want to pass. Give load_dol the butter and args, grab 'entrypoint' address. Jump to the entry point to begin execution.