问题
I'm curious. I have a library (static and dynamic version) compiled with visual studio for Windows 64bit which I want to use on Linux. This is a commercial library and to get the same library compiled for Linux will take many days of emailing and reminding and so on and so on.
Can I use one of these two library variants (and these are not .net, but native libraries) to link to them on Linux machine?
回答1:
Theoretically, you should be able to do so.
It would be an awful lot of work, but this is for instance how windows audio/video codecs are loaded by MPlayer.
You would have to write from scratch the interface wrapper, load the dll, and fix up the calling conventions.
It is a lot of work, however, that makes most sense if the library is self-contained, interfaces are scarce and well understood, and the other option would take too much time.
(essentially, if you understand what goes into writing a linker for both linux and windows) :)
Please let me know if you need any help with that.
回答2:
No, you cannot do that, I'm afraid
回答3:
No you can't do that. You can either try to get the linux version, or build your program on windows and run it on linux with emulator, for example wine.
来源:https://stackoverflow.com/questions/4469250/using-libraries-compiled-for-windows-on-linux