Search code examples
linuxvisual-studiog++cygwin

using compiled libs between windows compiler, cygwin and linux g++


If I have a windows compiler based dll and .lib, can I link them with a app that I am compiling with cygwin g++ ? If not, will it work with a linux g++ library build ?

Are libraries generated from windows compiler, cygwin g++ and linux g++ cross linkable ??


Solution

  • No there are not. Libraries and executable files are specific to an operating system and to a processor. The only thing you can consider porting is source code, if it is written with great care. Some libraries (e.g. QtCore, Gtk/Glib, ...) are abstracting a platform and give you a common API (usable on many OSes), but you still have to compile for each system.

    You could target a virtual machine (like JVM thru Java, or Lua bytecode, or Ocaml bytecode, ...) to get additional portability (at the expense of the cost of the VM implementation). You could also code software as scripts (e.g. using Python).