If you're trying to load an external dynamic library, it has to be compiled for the platform you're trying to load it on. On Windows, it'll be a DLL file, on Linux it's a .so
file ("shared object"), on OSX I have no idea what it'll be... But if you want to load a file that essentially contains machine code, it has to be compiled for the target platform you want to run it on.
If you're asking "can I get Haskell to figure out which file it needs to load based on the platform I'm running on", well that is another question... ;-)