This directory contains 

 - solution files and project files for building MzScheme and MrEd
    with Microsoft Visual Studio 7.1 and up (which work with the .NET
    and Express 2005 versions of Visual Studio);

 - mzconfig.h which is a manual version of information that is
    gathered automatically when using the "configure" script.

Visual Studio Express is available for free from Microsoft, and it is
the recommended compiler for building PLT Scheme.

MzScheme and MrEd also compile with Cygwin gcc (a free compiler from
GNU and Cygnus Solutions), but the result is a Unix-style
installation, not a Window-style installation. To compile with gcc,
follow the instructions in plt\src\README (which contains a short
Windows-specific section).

With an MSVC-built MzScheme, compatible extensions can be built with
other compilers. Build with Cygwin and copy the installed plt\lib\gcc
to a MSVC-based build to support Cygwin-built extensions. To support
Borland-built extensions, cd to plt\src\mzscheme\dynsrc and run
mkbordyn.bat (which requires bcc23.exe, of course).

As always, please report bugs via one of the following:
  - Help Desk's "submit bug report" link  (preferred)
  - http://bugs.plt-scheme.org/
  - bugs@plt-scheme.org                   (last resort)

-PLT
 scheme@plt-scheme.org

----------------------------------------------------------------------
Building MzScheme, MzCOM, and MrEd
----------------------------------------------------------------------

The source code for MzScheme, MzCOM, and MrEd is split into several
projects that are grouped into a few solutions. To make the `X'
solution with Visual Studio, open the file plt\src\worksp\X\X.sln.
[When you open a solution, the selected configuration will most likely
be "Debug". Consider changing to "Release" before you build to enable
optimization.]

To build MzScheme, make the MzScheme solution in
   plt\src\worksp\mzscheme - makes plt\mzscheme.exe

To build MzCOM, make the MzCOM solution in
   plt\src\worksp\mzcom - makes plt\collects\mzcom\mzcom.exe

To build MrEd, make the MrEd solution:
   plt\src\worksp\mred - makes plt\mred.exe

The make processes for MzScheme and MzCOM automatically build
   libmzgc - makes plt\lib\libmzgcxxxxxxx.dll and
             plt\src\worksp\libmzgc\Release\libmzgcxxxxxxx.lib
   mzsrc - makes plt\lib\libmzschxxxxxxx.dll and
                 plt\src\worksp\mzsrc\Release\mzsrcxxxxxxx.lib

The make process for MrEd automatically builds
   libmzgc - as above
   libmzsch - as above
   libmred - makes plt\lib\libmredxxxxxxx.dll and
                   plt\src\worksp\libmred\Release\libmredxxxxxxx.lib
   wxutils - makes plt\src\worksp\wxutils\Release\wxutils.lib
   wxwin - makes plt\src\worksp\wxwin\Release\wxwin.lib
   wxs  - makes plt\src\worksp\wxs\Release\wxs.lib
   wxme  - makes plt\src\worksp\wxme\Release\wxme.lib
   jpeg  - makes plt\src\worksp\jpeg\Release\jpeg.lib
   png  - makes plt\src\worksp\jpeg\Release\png.lib
   zlib  - makes plt\src\worksp\jpeg\Release\zlib.lib

In addition, building MzScheme executes
   plt\src\mzscheme\dynsrc\mkmzdyn.bat
which copies .exp, .obj, and .lib files into plt\lib\, and also copies
DLLs from the extradlls directory to to plt\lib\.

To complete a build, run the versioning script described in the next
section.

----------------------------------------------------------------------
Versioning
----------------------------------------------------------------------

The obnoxious "xxxxxxx" in the DLL names is a placeholder for a
version number. Embedding a version number in a DLL name appears to
be the simplest and surest way to avoid version confusion.

For local testing, you can use the "xxxxxxx" libraries directly. For
any binaries that will be distributed, however, the placeholder should
be replaced with a specific version.

To replace the "xxxxxxx" with a specific version, run

  mzscheme -mvqL winvers.ss setup

in a shell. The "winvers.ss" program will have to make a temporary
copy of mzscheme.exe, libmzschxxxxxxx.dll, and libmzgcxxxxxxx.dll (in
the temporary directory), and it will re-launch MzScheme a couple of
times. The resulting conversions are
  plt\mzscheme.exe -> plt\mzscheme.exe (updated)
  plt\mred.exe -> plt\mred.exe         (updated)
  plt\mzcom.exe -> plt\mzcom.exe       (updated)
  plt\lib\libmzgcxxxxxxx.dll -> plt\lib\libmzgc<version>.dll
  plt\lib\libmzschxxxxxxx.dll -> plt\lib\libmzsch<version>.dll
  plt\lib\libmredxxxxxxx.dll -> plt\lib\libmred<version>.dll
  plt\src\worksp\libmzsch\Release\libmzschxxxxxxx.lib
                          -> plt\lib\win32\msvc\libmzsch<version>.lib
  plt\src\worksp\libmzgc\Release\libmzgcxxxxxxx.lib
                          -> plt\lib\win32\msvc\libmzgc<version>.lib

----------------------------------------------------------------------
Extra stuff for MzScheme and MrEd
----------------------------------------------------------------------

If you're building from scratch, you'll also want the starter
programs used by the launcher collection to make drscheme.exe
and mzc.exe:

   mzstart - makes plt\collects\launcher\mzstart.exe
   mrstart - makes plt\collects\launcher\mrstart.exe

Then, set up all the other executables (besides mred.exe
and mzscheme.exe) by running

   mzscheme.exe -mvqM- setup

(This makes the .zo files, too. To skip compiling .zos, 
add -n to the end of the above command.)

----------------------------------------------------------------------
Finding DLLs
----------------------------------------------------------------------

Since the DLLs libmzgcxxxxxxx.dll, libmzschxxxxxxx.dll, and
libmzmredxxxxxxx.dll are installed into plt\lib\ instead of just plt\,
the normal search path for DLLs would not find them when running
"MzScheme.exe" or "MrEd.exe". To find the DLLs, the executables are
"delayload" linked with the DLLs, and the executables explicitly load
the DLLs from plt\lib\ on start-up.

The relative DLL path is embedded in each executable, and it can be
replaced with a path of up to 512 characters. The path is stored in
the exeuctable in wide-character format, and it is stored immediately
after the wide-character tag "dLl dIRECTORy:" with a wide NUL
terminator. The path can be either absolute or relative; in the latter
case, the relative path is resolved with respect to the
executable. Replacing the first character of the path with "<"
disables the explicit DLL load, so that the DLLs must appear in the
normal DLL search path.

See also ..\README for information on the embedded "collects" path in
the executables.

----------------------------------------------------------------------
Embedding MzScheme
----------------------------------------------------------------------

The MzScheme DLLs can be used within an embedding application.

The libraries

    plt\lib\win32\msvc\libmzschxxxxxxx.lib
    plt\lib\win32\msvc\libmzgcxxxxxxx.lib

which are created by the mzsrc and gc projects, provide linking
information for using the libmzschxxxxxxx.dll and libmzgcxxxxxxx.dll
DLLs. The versioning script adjusts the names, as described above.

See the "Inside PLT MzScheme" manual for more information about using
these libraries to embed MzScheme in an application.


If you need MzScheme to link to a DLL-based C library (instead of
statically linking to the C library within the MzScheme DLL), then:
 
 1. Compile MzScheme with the /MD flag.

 2. Define the pre-processor symbol USE_MSVC_MD_LIBRARY while
    compiling the GC with /MD.

 3. In your embedding application, call GC_pre_init() before calling
    any MzScheme and GC function.
