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...