Windows CE_ Pocket PC
Last changed: -




This is a short guide to build Squirrel 2.1 final for Windows CE/Pocket PC.

The tool used will be Embedded Visual C++ 4. Recently Microsoft decided to move mobile development on Visual Studio 2005 Professional, but Embedded 4 is still available, for free, and it is ok to develop for Pocket PC 2003 and Windows CE 4/5.

Usually I divide the project in 2 subprojects: squirrel (the core files) and sqstdlib (the standard library). Both projects are set to generate a static library (squirrelCE.lib and sqstdlibCe.lib)

First of all it is necessary to modify a bit some code in sqvm.cpp (the same twiks are necessary for Visual Studio 6).

At line 935 of sqvm.cpp there is this: (


                for(SQInteger i = 0; i< arg0;i++)
                     _etraps.pop_back(); traps--;

We need to change it in:

 case _OP_POPTRAP: {
                                for(SQInteger i = 0; i < arg0; i++) {
                                        _etraps.pop_back(); traps--;

Actually we just surrounded the for cycle with a couple of {} brackets.

Then we need to build the sqstdlib.

It is a little bit more tricky, because of someissues with wchar_t and some functions missing from Windows CE.

When creating the project, just forget about sqstdsystem.cpp.

Then you have to change every other cpp file in the sqstdlib folder and make it include this file (copied from a file with the same name in the squirrel folder) instead of squirrel.h


 /*        see copyright notice in squirrel.h */
 #ifndef _SQPCHEADER_H_
 #define _SQPCHEADER_H_

 #if defined(_MSC_VER) && defined(_DEBUG)
 #include <crtdbg.h>

 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 #include <new>
 //squirrel stuff
 #include <squirrel.h>
 //#include "sqobject.h"
 //#include "sqstate.h"

 #endif //_SQPCHEADER_H_

I just commented out the last two "includes".

In this way I could compile Squirrel 2.1 (this tweaks were not necessary with old versions).

I still need to experiment a bit, but, if someone wants to help/test I'l be more than happy to share.