Pocket PC Build

From reSIProcate
Jump to navigation Jump to search

The following is derived from a message that Jori Liesenborgs posted to the resiprocate developers list. These instructions were developed for version 6387, but should work (perhaps with some minor modifications) for other versions as well.

Ok, I'll try to explain what I did to get resiprocate working on WinCE, what problems I encountered and how they can be solved. I'm using MS Visual Studio 8 and the Pocket PC 2003 SDK.

The resiprocate repository already includes several files to be able to compile the library on WinCE. In the subdirectory rutil/wince there are several standard include files which usually don't exist on wince, like sys/types.h, errno.h etc. The availability of these files makes the port a lot easier.

Compiling the library for WinCE is not that hard. I used a WinCE static library project and I added the following source files:

  • in contrib/ares: the ares_*.c files
  • in rutil: all *.cxx files
  • in rutil/dns: all *.cxx files
  • in rutil/stun: all *.cxx files
  • in rutil/wince: WceCompat.cxx
  • in resip/dum: all *.cxx files
  • in resip/stack: all *.cxx files except makeCert.cxx and MacSecurity.cxx

In the project settings, I added the following defines: WIN32, USE_ARES and USING_CE

To the include directories, I added the rutil/wince, contrib/ares and the ./ subdirectories (assuming that the project file is in the same directory as the reSIProcate_7_1.sln file).

I also enabled the run-time type information flag in the project settings.

These settings should allow you to compile the library, but you won't be able to create a working test application. First of all, when you try to link the application, you'll get errors saying that functions like 'time', 'gmtime' etc are not found. You can solve this problem by using the LibCE library which can be found at: http://studierstube.icg.tu-graz.ac.at/handheld_ar/

After doing this, linking the application worked, but the test program crashed very soon. After some debugging, I found out that the problem was that inside the library, a sizeof(SipStack) resulted in 0x47900, but doing the same thing in my main routine, resulted in 0x478f0. This 16 byte difference caused stack corruption and resulted in a crashing program.

In my WinCE test program, windows.h was included before the resip/SipStack.hxx file (by including the stdafx.h file). When compiling the resiprocate library, the windows.h file is not included first, and this seems to cause some datatype do be defined differently (I haven't found out which one(s) exactly). When an #include <windows.h> was added to the SipStack.cxx file, the size difference was no longer there.

Unfortunately, adding that include line to the SipStack.cxx file did not allow a slightly more complex program to run. I then used a small script to add a line "#include "resipconfig.h" to all the *.cxx and *.hxx files in the rutil, rutil/dns, rutil/stun, rutil/wince, resip/dum and resip/stack directories. In that resipconfig.h file, i put the following lines:

#ifdef WIN32
        #include <winsock2.h>
        #include <windows.h>
#endif // WIN32

After this I recompiled the library and tried the BasicCall.cxx test application (using a WinMain() instead of the main() function). The program worked perfectly and to prove it, I've added its output below. After this, I modified the BasicCall.cxx file to make a call to a SIP phone possible, and using EMIPLIB for the VoIP part, I was able to establish a VoIP session between my PDA and the SIP phone.

I'm not sure if the way I solved the problem is a clean solution, but it worked for me. Hopefully, someone else may find this information useful as well.