How do I cross-compile C code on Windows for a binary to also be run on Unix (Solaris/HPUX/Linux)?

后端 未结 7 1970
我在风中等你
我在风中等你 2020-12-10 19:12

I been looking into Cygwin/Mingw/lcc and I liked to be able to compile perl native C extensions on my windows(preferably under cygwin) and then run them on Solaris and HP un

7条回答
  •  情歌与酒
    2020-12-10 19:30

    No, this isn't possible at the binary level. There are so many differences at binary level between the various OSes and CPUs.

    But what you can do is make the your C extensions source compatible so that it can compile to different platforms. C was designed as a "portable assembly language". As long as you stick with routines that are cross-platform, then they will usually work the same. You'll still need to test because there could be bugs that exists on particular platform.

提交回复
热议问题