Back to my webpage

Deploying Sicstus Prolog Standalones on Windows XP
Using Microsoft Visual C++ 2005 Express Edition
Sandiway Fong
University of Arizona
January 2007

In the interests of sanity, I hereby document some of the gotchas and solutions for deploying Sicstus Prolog standalone applications on the Windows XP platform.

For me, sanity was barely preserved as it cost me three solid days of frustration. Someone once wrote (in equivalent French): "All the mornings of the world are without return." For me, a few of those figurative mornings involve more than one sense of the word "return".

I write this so that you can avoid that downtime. I believe this document is current and relevant at the time of writing, after which there are no guarantees (of course).

This document pertains to Sicstus Prolog 3.12.7 and Microsoft Visual C++ 2005 Express Edition with and without SP1 (Service Pack 1).

Executive Summary

The short answer is yes you can use Visual C++ Express Edition to build Sicstus Prolog standalones.

You need to install Microsoft Visual C++ 2005 Express Edition and the Platform SDK. From

1. Make sure you're ready!
Before installing, you must uninstall any previous Beta, CTP or Tech
Preview versions of SQL Server 2005, Visual Studio 2005, and the .NET
Framework 2.0.

2. Download and install
Download and install Visual C++ 2005 Express Edition!!
Install the Platform SDK
You will now want to install the Microsoft Platform Software
Development Kit (SDK).
However, if you want to deploy your executable to any machine (other than the compile machine), crucially you will want to avoid installing:
Additional Downloads
Microsoft Visual Studio Express Editions 2005 Service Pack 1


To deploy the executable built by spld, i.e. I'm assuming you want to be able to run the executables on machines other than the compile host, you will have to jump through some hoops. The reason for this is to do with how DLLs (Dynamic Link Libraries) are baroquely organized in Windows XP via manifests.

In particular, since we are compiling with Visual C++ 2005, we have to also distribute the runtime system for Visual C++ 2005 (msvcr80.dll).

One difficulty that immediately arises is that the appropriate runtime DLL for Visual C++ 2005 is not the same as Visual C++ 2005 Express Edition, which in turn is not the same as Visual C++ 2005 Express Edition with Service Pack 1 or some other "hotfix" version.

There are three ways to re-distribute Visual C++ DLLs for applications built with Visual C++:

  1. Using Visual C++ Redistributable Merge Modules to install a particular
    Visual C++ library as shared side-by-side assemblies into the native
    assembly cache (WinSxS folder).
    First method requires the enduser to have administrator rights and for the develop to package things in an installer. Plus it's not available as an option for the free version of Visual C++. So that's out unless you want to buy Visual Studio.
  2. Using Visual C++ Redistributable Package (VCRedist_x86.exe,
    VCRedist_x64.exe, VCRedist_ia64.exe) to install all Visual C++
    libraries as shared side-by-side assemblies into the native assembly
    cache (WinSxS folder).
    In other words, second method asks the enduser to install the libraries from Microsoft, i.e. the enduser should download and run vcredist_x86.exe. This is the Microsoft recommended route for Express Edition compiled applications. Sounds good but it seems like (but I forget whether) it requires the user to have admin privileges.

    You have to have the exact right version though. But comically, this is unavailable for download for the latest version of Visual Express C++ Express (SP1), plus the executable isn't installed by the compiler so you couldn't have redistributed it anyway.

    Relevant threads: How to deplay VC 2005 Express SP 1 solutions? / VC++ 2005 redistributable

    [This last thread is a classic. Contains beautifully poignant dialogue like the following:

    We have no plans of posting SP1 version of VCRedist for download. You should be using version of vcredist_*.exe installed by VS2005 SP1.

    The reply is:

    I like to kindly remind you that the SP1 does not install/upgrade a vcredist_*.exe for C++ Express Edition. My posting regarding this issue is not answered in the Express Forum.

    Is it possible to get any more comical than that?]

  3. Install a particular Visual C++ assembly as a private assembly for the
    application using files provide in the Program Files\Microsoft Visual
    Studio 8\VC\Redist directory.
    We discuss method 3 in the next section.

Private Assemblies

Method 3 (from the previous section) is elaborated in this thread: Running a very simple app on a comp without VC++ 2005 Express

I've extracted the relevant parts below:

1) On the machine you have Express installed, create the following
folder and subfolders in your \program files\microsoft visual studio
8\VC folder:


2) Copy msvcr80.dll, msvcp80.dll, msvcm80.dll from


\program files\microsoft visual studio 8\VC\redist\x86\Microsoft.VC80.CRT

3) in the above Microsoft.VC80.CRT folder, create a new file named:


4) Paste the following content into the above manifest file:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Copyright © 1981-2001 Microsoft Corporation -->
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <file name="msvcr80.dll"/>
    <file name="msvcp80.dll"/>
    <file name="msvcm80.dll"/>

Now you have a new folder in your Visual C++ Express installation that
can be re-used when ever you need it.

To deploy these files, simply copy the Microsoft.VC80.CRT folder you
just created to your program folder.  That's it.  So for example, if
your application executable resides in C:\Program Files\MyApp, you'll
have a folder named:

C:\Program Files\MyApp\Microsoft.VC80.CRT

that contains the 4 files I mentioned (3 DLLs and one manifest file
you created by hand)

The problem is that method 3 above doesn't work when you are using Visual C++ 2005 Express Edition with SP1. I complained about it and the solution is to uninstall SP1.

Relevant thread: VC++ 2005 Express deployment problem


The easiest way to use Visual C++ 2005 Express with Sicstus Prolog is to run it in the command line environment provided when you install Visual C++. You can get to it from the Program Menu.

I also set my PATH to include the appropriate Sicstus Prolog bin directory.

Using the Visual Studio Command window, I just cd to my application directory and type:

spld --static --resources-from-sav treebankview.sav -o tbv.exe
This creates both tbv.exe and tbv.exe.manifest.

Put them both in a new application directory, in my case: treebankviewer. And then add to that directory the Microsoft.VC80.CRT directory and contents as specified in the previous section.

Simply zip encode the application directory for distribution and it's truly standalone and runnable without admin privileges.

Back to my webpage
Last modified: Sun Jan 14 06:43:02 MST 2007