문제

Can be a windows dll used/interfaced with Haskell's FFI(Foreign Function Interface) on a non windows OS? For example if I have OSX, can I interface a .dll with FFI (use the dll functions) ?

Example: I have a my.dll file that was written and compiled in Windows. With Haskell's FFI (Foreign Function Interface) I can write a program in Haskell that will load my.dll and use the functions from it. The question is: can I write a Haskell program in OSX and use my.dll via FFI, or does it has to be Haskell program compiled in Windows (since I want to use my.dll)?

도움이 되었습니까?

해결책

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... ;-)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top