Difference between revisions of "Microsoft Windows"

From Simson Garfinkel
Jump to navigationJump to search
m
Line 12: Line 12:
 
==Setting up a Windows Development Environment==
 
==Setting up a Windows Development Environment==
 
* Download and install [http://cygwin.com Cygwin]. Run the setup and be sure to install "devel" so that you can develop.
 
* Download and install [http://cygwin.com Cygwin]. Run the setup and be sure to install "devel" so that you can develop.
* Download and install MSYS frmo the [http://www.mingw.org/ MinGW] website.
+
* Download and install the Automated MinGW Installer from the [http://www.mingw.org/ MinGW] website.
 
* Download and install the free Microsoft Visual C++ Express.
 
* Download and install the free Microsoft Visual C++ Express.

Revision as of 06:35, 9 July 2010

Windows Development

I'm primarily a Unix developer, but some of the code that I maintain has to run on Windows. Here's a list of useful things for other Unix programmers that are put into this position.

Microsoft VC++
Microsoft makes "express" versions of its Basic, C#, C++ and J# compilers available for free]. Presumably this is to compete against cygwin, which lets you compile and run traditional Linux/Unix free software on Windows. (I don't like using cygwin myself, becuase it requires the use of a special Cygwin DLL, it has traditionally had problems with multi-threading, and there have been performance issues in the past. But for many jobs Cygwin is probably just fine.)
Cryptography on Windows
Windows has a built-in CryptoAPI that can perform most cryptographic functions, but the API is completely non-standard. Microsoft posted an example C program to calculate the MD5 hash of a file using the CryptoAPI. Getting this program to actually compile requires that you install the Platform SDK in addition to the C++ compiler. Successfully linking the program requires information not present on the MSDN web page. I have uploaded the source code and a makefile for Microsoft's NMAKE to this server. However, it's usually easier just to include md5.h and md5.c if that's all you need.
mingw
mingw is a port of the Gnu C++ compiler and tool chain to Microsoft Windows. mingw emits Microsoft-standard .exe files and comes with .h files that are compatible with those that Microsoft ships. You can run mingw directly on Microsoft Windows or you can cross-compile from Linux or Macintosh computers. The advantage of running natively on Windows is that it's easier to debug; the advantage of cross-compiling is that you can run your entire development environment inside Unix, which generally runs faster than Windows on the same hardware.
Cygwin
Cygwin is another way to run Linux software on Windows. Instead of porting the compiler, Cygwin has a POSIX-emulation DLL that allows Unix programs to be run more-or-less natively on Windows. This approach is generally easier to use, because you have real Unix .h files and not Windows .h files, but it requires that you distribute the Cygwin .dll with your program. My experience is that Cygwin programs generally run slower than mingw programs because of the overhead imposed by the POSIX emulation layer.

Setting up a Windows Development Environment

  • Download and install Cygwin. Run the setup and be sure to install "devel" so that you can develop.
  • Download and install the Automated MinGW Installer from the MinGW website.
  • Download and install the free Microsoft Visual C++ Express.