HPCC-9890 Dynamic loading assumes .so extension (so can fail on OSX)

The code should have been using the defines from platform.h.

It was also very sloppy in the assumptions about when and where to add the lib
prefix.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>