Linking with cygwin1.dll while building with mingw32?

Viewed 685

I wish to port a Linux C++ application to Windows with the minimum possible effort (i.e. no code modifications at all, and no entirely new build system).

The application is mainly doing API calls to SDL and OpenGL, which both are available on Windows. However, it also uses POSIX functionality such as ptys, which are preventing me from using the mingw32 toolchain.

Cygwin, or, more precisely, cygwin1.dll, implements the whole POSIX API and internally translates it to Win32. I understand that Cygwin also comes with its own compiler suite, but to my understanding it is impossible to directly make calls to Win32 or other Windows libraries (such as SDL or OpenGL).

Hence, my idea is to build the project with mingw32 (which is conveniently also available as a cross-compiler on most distros), but in addition also link with cygwin1.dll. I am, however, getting suspicious by the fact that nobody on the internet seems to have tried this, and the seeming unavailability of the cygwin compiler on Linux.

So my question would be:

  • Is this a legitimate idea, or will everything fail horribly even if I manage to hack it together?
  • What's the legitimate way of doing it (where do I get the cygwin headers and dll file)?

Licensing is not an issue.

2 Answers
Related