Microsoft eMbedded Visual C++ 4.0

Well I was looking for a way to cross compile to the MIPS and also if I could use my old Platform builder 2.11..  Anyways Platform builder has cross compilers, but no libraries, I figured you need the eMbeded Visual C++.  And as luck has it, you can download it right here!  Also you’ll probably want service pack 4 (local mirror), and don’t forget the code TRT7H-KD36T-FRH8D-6QH8P-VFJHQ

System Requirements
  • Supported Operating Systems: Windows 2000; Windows XP
  • Microsoft Windows® 2000 Professional SP2, Microsoft Windows 2000 Server SP2, or Microsoft Windows XP Professional
  • A desktop computer with a Pentium-II class processor, 450 MHz or faster
  • 96 MB (128 MB recommended) memory for Windows 2000 Professional or Windows XP Professional. 192 MB (256 MB recommended) memory for Windows 2000 Server.
  • 200 MB hard disk space
  • CD-ROM drive
  • VGA or higher-resolution monitor. A Super VGA (800 x 600 or larger) monitor is recommended.
  • Mouse or compatible pointing device

If your machine is NOT up to this kind of capability, then you can download the older eMbedded Visaul C++ 3.0, that will run on Windows NT 4.0 (i386 of course). Purdue also had a nice walkthrough on installing the 3.0 tool kit.

I DO recommend that you install IIS on your cross compiling machine, as it’s an easy way to move your object files to the MIPS host for linking.

It is worth noting that Visual C++ 4.0’s emulator will NOT run under Virtual PC.  They use the same call set, and it thinks VPC is Windows CE..  I know it’s confusing.

I would imagine everyone could run this…  Well if they were so inclined.  Well the installation is pretty simple but now for the ‘fun’ stuff.

First let’s download the source code to Quake.  ID software has been most kind to provide the Quake engine under the GPL!  So we can use it for a MIPS cross compile test.. (As far as I know there is no Dec Alpha cross compiler, but there is a PowerPC.. Anyone use a PowerPC NT machine?)  You can download it here.  This went nowhere, as it turns out WindowsCE and Windows NT use different models for floating point, and are incompatible.

Ok with your embedded tools installed, we are now going to merge our Visual C++ MIPS CD so we use it for libraries & include files.  Since we are all going to use the same compiler it’ll be somewhat easy.  I’m using the tools out of “C:\Program Files\Microsoft eMbedded C++ 4.0\EVC\WCE400”

11/27/2001  03:00 AM         1,073,152 C1XX_MP.DLL
11/27/2001  03:00 AM           581,632 C1_MP.DLL
11/27/2001  03:00 AM         1,056,768 C2_MP.DLL
11/27/2001  03:00 AM            69,632 CLMIPS.EXE
06/13/2001  03:00 AM           180,276 MSPDB60.DLL

To make it “feel” like visual c++ 2.0 I’m going to put them in the c:\msvc20\bin directory on my HOST pc (Vista Pro x64).  Then I simply copy the include & lib directory from the MIPS Visual C++ CD into the corresponding directories on my host.  We are ALMOST there.

The next thing I did was to grab an intel copy of Visual C++ 2.0 (I almost be dammed near all of them can do this..) and take it’s linker.  The linker out of the embedded tools is obsessed with the windowsce subsystem which won’t help us at ALL.

09/16/1994  01:00 PM            67,584 DBI.DLL
09/16/1994  01:00 PM            12,980 LINK.ERR
09/16/1994  01:00 PM           420,352 LINK.EXE

Go ahead and place those files into the c:\msvc20\bin directory.

Now we just need to create a simple batch file to keep our enviroment in order:

set LIB=c:\msvc20\lib

set PATH=c:\msvc20\bin;%path%

set include=c:\msvc20\include

Save that to something like mipvars.cmd, and run it & we should be ready to start compiling!

To test the cross compiler I’m going to build a SIMPLE program that has 2 files.

hi.c

#include <stdio.h>

extern int bob(void);

void main(void)
{
printf(“%d”,bob());
}

bob.c

int bob(void)
{
return 3;
}

Ok, now we compile it like so:

C:\msvc20>clmips *.c -o bob.exe
Microsoft (R) C/C++ Optimizing Compiler Version 12.20.9419 for MIPS R-Series
Copyright (C) Microsoft Corp 1984-2001. All rights reserved.

bob.c
hi.c
Generating Code…
Microsoft (R) 32-Bit Incremental Linker Version 2.50
Copyright (C) Microsoft Corp 1992-94. All rights reserved.

/out:bob.exe
/out:bob.exe
bob.obj
hi.obj
LINK : error LNK1104: cannot open file “corelibc.lib”

Oh no trouble!  Because this was all ripped from the embeded tools it wants to think it has corelibc not libc.  But we can cheat, just copy libc.lib to corelibc.lib and I’ve also copied rpcndr.lib to coredll.lib to satisfy the linker.  Now when we re-compile:

C:\msvc20>clmips *.c -o bob.exe
Microsoft (R) C/C++ Optimizing Compiler Version 12.20.9419 for MIPS R-Series
Copyright (C) Microsoft Corp 1984-2001. All rights reserved.

bob.c
hi.c
Generating Code…
Microsoft (R) 32-Bit Incremental Linker Version 2.50
Copyright (C) Microsoft Corp 1992-94. All rights reserved.

/out:bob.exe
/out:bob.exe
bob.obj
hi.obj

That’s right, we got an executable!  Now if you run it on your x86(or x64) host you’ll get this:

c:\msvc20\bob.exe is not a valid Win32 application.

And of course since you installed IIS on your HOST( or cross compiling VM) you can connect to it from your MIPS vm, download the exe & run it.

MIPS cross compile

MIPS cross compile

I’m kind of surprised it worked.  It does go to show though, that somewhere inside Microsoft they have some COOL cross compiler technology, it’s just too bad they didn’t make it into an easy package for the RISC stuff.  But now that the MIPS is coming back to life via Qemu, and NT 4.0 can be had for $5 a retail box on ebay… I figure it’s worth this much for those people who can find Visual C++ for MIPS/RISC.

This entry was posted in cross compiler, mips by neozeed. Bookmark the permalink.
avatar

About neozeed

What is there to tell? I’ve loved UNIX like things since I was first exposed to QNX in highschool (we had the Unisys ICONS!), and spent the better time of my teenage years trying to get my own UNIX… I should have bought Coherent in retrospect.. Anyways latched onto Linux in 1992, and then got some old BSD admin books and have been hooked on the VAX BSD & other big/ancient things since…!

3 thoughts on “Microsoft eMbedded Visual C++ 4.0

  1. There is one important caveat here, if your program uses floating point it currently does not compile correctly, and the linker freaks out…

    Ive transfered the object files to the mips host, and its linker breaks as well.

    However building it on the MIPS host, and transfering the objects to the pc, and it links correctly..

    There is something weird with the CE'ized Visual C++ for the MIPS when it comes to floating point math.

Leave a Reply

Your email address will not be published.

Notify me of followup comments via e-mail. You can also subscribe without commenting.