added Artur's OSX dlload() emulation, with minor changes