Port Shell Scripts
With fully functional C and Korn shells along
with the usual crop of data-crunching tools
such as sort, uniq, and col, porting most
shell scripts should be relatively easy. Good
candidates are scripts that transform data
files—for example, sorting or merging them,
removing duplicates, or filtering out selected
columns before they are loaded into or after
they are retrieved from a database—and a
script that uses FTP to send or receive data
files. The FTP client and server that come
with the subsystem are more functional
than their Windows counterparts. Many
organizations still rely on FTP to move vast
amounts of data and depend on UNIX systems
for additional features and scriptable
FTP clients.
Build C and C++
Applications
SUA includes support for porting UNIX C
and C++ applications, but you need to know
a few things. The subsystem comes with
support for the GNU C and C++ compilers.
However, the default is to use compiler
interfaces to Microsoft Visual Studio, which
must be installed. Visual Studio can be used
to compile only applications that are written
in C—not in C++. Figure 6 shows the contents
of a Makefile—a very simple C file—and an example of what happens when you run the
make command.
If you don’t have Visual Studio and you
need to compile C++ source code or simply
prefer to use the GNU compilers, you can
do so by explicitly calling gcc or g++. When
you use the GNU compilers, you have to be
careful which file extensions you employ.
For example, a C++ source code file in Windows
usually has a .cpp file extension., but
the g++ compiler expects C++ source code
files to have a .cc file extension. If your file
has the wrong extension, you might encounter
apparently random errors, especially on
64-bit hardware platforms. I recommend that
you check SUA’s Help files and release notes;
these documents contain useful information
that can help you avoid some pitfalls.
In the /usr/examples directory, you’ll
find sample source code that demonstrates
how to use the Oracle Call Interface (APIs for
using an Oracle database) and ODBC APIs.
The sample code included shows you how
to use the Open Network Computing remote procedure call client to make calls to remote
systems.
In porting packaged applications to
SUA, you might come across configure shell
scripts, which you can use to analyze your
system and create the makefiles necessary to
build applications. Older configure scripts—
specifically config.guess and config.sub—
don’t work well with the subsystem, and I
recommend that you download the latest
versions of these scripts from ftp.gnu.org
before porting the applications.
When porting or building X Windows
applications, make sure that the necessary
prerequisites are installed and available.
Many X Windows applications use thirdparty
add-ons or fonts that you must build
or install first. Most mainstream packages
should port relatively easily, especially if you
use the GNU compilers.
An Alternative
Now that I’ve introduced you to the Subsystem
for UNIX-based Applications that ships with Server 2008 and Vista, you should have
a good handle on some of the subsystem’s
major features. This subsystem provides
a feasible alternative to UNIX systems for
many enterprises, letting them eliminate
legacy dedicated UNIX systems by migrating
applications to Server 2008 or Vista. The
subsystem’s feature-rich shells, file manipulation
tools, easy daemon startup, and networking
support can actually make it easier
to develop and run some scripts and utilities
in SUA than in a native Windows environment,
while still enabling organizations to
benefit from the many features of the Windows
platform.