revert lt_dlopenext to the code from v3.0.x.

There isn't much point in printout out extra information,
and it was breaking the build
Fix duplicate prototypes and header definitions.

So that the code can build