[PythonCE] compiling for winCE

Huy huymail at swiftdsl.com.au
Thu Sep 2 18:08:34 CEST 2004

Ajay wrote:
> hi!
> would people who have successfully ported packages to pocket pc please post
> a howto/guide to porting a package to pocket pc?
> what do you need to do? what do you need in to set up in the build
> environment?
> please help

I don't know about porting other packages but I have written my own 
python extensions using embedded c++ 4.0 for pocket pc 2003 running on 
the python 2.3.4. At the moment I'm using it for things which win32gui 
does not fully support eg. SHFullScreen SIPShowIM etc.

Here are the steps I took to get it to work on the platform above.

1. Install Embedded Visual Tools C++ 4.0
2. Install Embedded Visual Tools C++ 4.0 SP3
3. Install Pocket PC 2003 SDK
(these files can be downloaded from microsoft web site)
4. Create new project in EVC (Dymanic Link Library).
5. Write your C/C++ code to do whatever it is you want to do. Don't 
worry about interfacing it with python. Write it as if you are using it 
6. Compile it and make sure it is all working.

7. Install the python source code
8. Install the pythonce source code (overlay on top of python source)
9. Build pythonce following instructions on David Kashtans' site.

10. Install SWIG. See the tutorial on their site for a quick run down on 
how to get it too work with your C++ code and python. Basically you need 
to write an interface file eg. if you have source file modulename.cpp 
then create a file called modulename.i and chuck stuff in that (see the 
tutorial for details)

run swig on your interface file as follows:
swig.exe -python -shadow -o modulename_wrap.cpp modulename.i

This will generate the source_wrap.cpp file which you now need to add to 
your evc4 project.

In you evc4 project settings,
1. go to the c/c++ tab and add the following to the project options box.

2. go to the link tab and change your dll output file name to 
_modulename.pyd (pyd files are the dll files with a pyd extension; i 
didn't know this until today). Now build the project and hopefully you 
should have a _modulename.pyd file in your build directory.

Now move the files
_modulename.pyd and modulename.py (this file is generated by swig when 
issuing the -shadow command) to your pocket pc python lib directory.

You should now be able to import the module in your python programs.

This is my first try at both writing a python extension as well as 
playing with pythonce so if any of the veterans on the list could give 
me any extra pointers, I would be most grateful.


More information about the PythonCE mailing list