Fix use of dlsym(). According to the man page NULL being returned
doesn't necessarily mean an error and instead we dlerror(). I've done
this put having a NULL pointer in our case definitely is an error
so we exit on this too.

I've also switched to using _exit() which avoid destructors (does
that matter?)