Like this article? We recommend

Like this article? We recommend

Suppose you're a Linux-based developer. You wrote a complex library that
calculates weather statistics, or creates sound effects, or de-blurs
photographic images. You successfully deliver programs to an extensive list of
customers or co-workers. So far, so good. Yet, users have been asking you for a
version of your software that run on Windows.

You're flattered and you welcome the attention, but it's a
challenge. Sure, your code is well-written and it will port easily enough, but
how can you take on the burdens of managing a whole new development environment,
such as Microsoft's Visual C++ or Borland's C++ Builder? Will you have
to abandon your usual working environment for the inconveniences of
dual-booting, or use a second host that needs tending?

Well, no. You don't have to relocate. You can stay at home on your
existing Linux desktop, and tweak your environment a bit so that it
simultaneously generates Linux- and Windows-targeted results.
XMingwin, an open source
project, can do help you do that. It produces native Windows programs that do
not rely on any third-party DLLs.

A Useful Instance of A Big Topic

XMingwin is a "cross-development" package. The
"cross-minimalist-GNU-for-Windows" project (occasionally spelled
"Xmingw," "Xmingw32," and so on) is actually only a tiny
selection from a far bigger story. The open-source technologies involved are
flexible enough to have the potential to work with any host, any target, and any
language. In principle, you could write in Ada on an old MS-DOS box, and deliver
code that works on mainframes.

Understanding the full generality of cross-development is rather
breathtaking, if not intimidating. Rather than tackle all its abstractions,
let's look at a specific, concrete model case. Generalize your success with
this straightforward example to your own situation.

In practice, you probably use a Makefile or another more advanced generation
facility. (These, also, are abstractions outside the scope of this
introduction.) Once you have a simple case working reliably, you should be able
to apply the principles to Makefile on your own.

Next, install an XMingwin set of binaries (such as the one found
here).
With many open-source projects, it's most convenient to start from sources
and generate results yourself. Although you'll eventually want to do that
for XMingwin, I don't advise you to start there. Compiler
generation--especially of associated librariesis complex enough. Leave it
to others for your first experiments.