views:

188

answers:

2

Is there a Win32 equivalent to the linux header file? I'm working on a Linux to Windows port (and my first time doing so) and it's failing on this file.

+3  A: 

When writing WIN32API apps you usually #include <windows.h> - that includes most of the Windows API in your application. If you need to cut down on some of those includes, #define WIN32_LEAN_AND_MEAN will wipe out some of the more obscure things from the Windows libraries.

What functions are you trying to convert? It'll probably be a case of using a different function on WIN32; it is very different to Linux/Unix/POSIX.

Example: the ReadFile() function is roughly equivalent to read() in terms of general idea, but the calling signatures are very different. ReadFile()'s MSDN entry says:

Header: WinBase.h (include Windows.h)

Ninefingers
A: 

If you are porting to windows, it would be far easier to stick to cross platform standards, than diving straight into a native windows Api port (ala CreateFile).

I don't know what functionality is in , it looks like its part of the POSIX standard header files, but I can't find a reference to it in the posix sources.

There are a few build environments that you can use to port linux/unix applications to Windows.

  • If your application sticks to the C standard library for things like file IO, Dev Studio should support most of that natively. <stdio.h> for example has things like fopen.
  • MinGW provides a set of tools, but uses the microsoft c-runtime, so things like pthreads should be missing.
  • Cygwin is a far more conformant POSIX build environment.
  • SUA is Microsofts own offering.
Chris Becke