XmlBlaster Logo



XmlBlaster Logo

Type NEW
Priority HIGH
Topic Windows CE based xmlBlaster clients (C, C++, C#).

The C client library supports the Windows CE environment. This setup is tested for Windows CE 4.2 (Windows Pocket PC 2003) target on a ARMV5 processor (compatible to ARMV4). and a Windows Mobile CE 5.2 target with a ARMV8 processor.

OS Processor Comment
Windows CE 4.2 ARM It should run on any Smart Device (Pocket PC 2003 or Windows Smartphone 2003
Windows Mobile CE 5.1 ARM HP IPAQ hw6910 and Motorola HC700

Unmanaged code access (C,C++)

To compile the xmlBlasterClientC DLL use the -DWINCE command line setting.

The outcome is xmlBlasterClientC-Arm4.dll, pthreads270-Arm4.dll and zlib123-Arm4.dll.

You are now ready to use any C or C++ code to link against the dll.

Managed code access (C#)

There exists a P/Invoke wrapper around the above C dll which allows you to develop in the managed .net world.

When compiled the default target chosen is Win32 .net 2.x, this works fine for example on Windows XP or Windows 2003.

Please use the following preprocessor defines:

define Platform Comment
WINCE Windows CE To force Windows CE support, any of 'WINCE || Smartphone || PocketPC || WindowsCE' will do the same.
XMLBLASTER_MONO Linux To compile with mono 1.2 (C# 1 'mcs' or C# 2 'gmcs') on Linux
DOTNET1 Windows (XP etc) You can force .net 1.x compatible compilation with this flag. The outcome is not yet tested. As a default we assume .net 2.x
CF1 Windows CE To have Windows CE compact framework .net 1.x support, no callbacks are available in this case. It is strongly recommended to use the compact framework 2.x, you can just install it on your PDA and it will coexist with the CF1.
FORCE_NATIVEC_PLUGIN Windows (XP etc) All Windows targets use as a default the well tested PInvokeCE.cs wrapper plugin. Linux/Mono uses as a default the less tested NativeC.cs wrapper plugin. By setting this define on command line you can force the Windows Win32 target to use the NativeC plugin as well (don't try it with Windows CE, it will not work).
You can as well edit XmlBlasterAccess.cs and change the plugin there.

Example compilation on a Windows platform (Win32 or CE compact framework .net 2.x)

cd xmlBlaster\src\csharp

csc /unsafe -debug+ -out:TestPInvoke.exe PInvokeCE.cs XmlBlasterAccess.cs TestPInvoke.cs

Note: The xmlBlasterClientC.dll library is assumed to be in the same directory as the executable or available over the PATH setting. You can however force any fixed path by editing PInvokeCE.cs and recompile (search for the "xmlBlasterClientC" string).

Example compilation on a Linux platform (mono 1.2)

cd xmlBlaster\src\csharp

mcs /d:XMLBLASTER_MONO -debug+ -out:Hello.exe NativeC.cs XmlBlasterAccess.cs Hello.cs

Managed C++ wrapper (C++,VB.net,C#)

There is a first - not finished - prototype of a managed C++ code. Note that managed C++ is NOT supported on CE compact framework .net, it is only supported on normal desktop .NET environments. Probably this approach is dropped again as the above C# approach covers all and can act as a gateway for other .net languages.
This XmlBlasterManaged.cpp code is based on the new C++/CLI specification and is only supported in VC++ 2005 or newer.


Example for a Windows XP setup

Here is an example how to setup the development environment for free on Windows, using our ant build to compile.

See Visual Studio 2005 versus embedded VC++ 4.

Use the zlib 1.2.3 - http://www.zlib.net/ - and compile yourself for Windows CE. Set /DZLIB_DLL (and /D_WIN32_WCE if not defined yet) and switch off pre-compiled headers (exclude gzio.c and example.c).
To switch zlib on during xmlBlasterClientC compilation use the compiler define XMLBLASTER_ZLIB=1.

To have single threaded xmlBlaster access (to publish(), get(), but no update()) please set the compiler define XB_NO_PTHREADS=1. Like this you avoid to install pthreads.

To have full multi threaded access with xmlBlaster callbacks please link against the pthreads-win32 2.7.0 library from http://sources.redhat.com/pthreads-win32/.
Download the patch for Windows CE from http://www.xmlBlaster.org/wince/pthreads-2006-11-29.patch and apply it on pthreads 2.7.0 or better the cvs checkout from 2006-11-29.
Compile pthread.c, pthread.h and config.h with the compiler defines /DWINCE and /D_ARM_. (all other files are automatically added by pthread.c)


Example for a Linux development setup

Here is an example how to setup the development environment for free on Linux.

Tool Version Comment
synce tools synce Access your PDA from Linux over USB, bluetooth or Ethernet (WLAN), get the PDA GUI onto your Linux desktop
g++ crossompiler cegcc Crosscompiler: Edit and compile on Linux, run on Windows CE

Accessing xmlBlaster from C#

We provide a wrapper around our Windows CE xmlBlaster client library called xmlBlaster/src/csharp/PInvokeCE.cs.

It wraps the xmlBlasterClientC-Arm4.dll (and pthreads270-Arm4.dll, zlib123-Arm4.dll). Like this any C# code can access xmlBlaster with compression support, multithreaded and with tunneled callbacks.

A demo client to get you started is xmlBlaster/src/csharp/TestPInvoke.cs.

You need to compile the three dlls yourself or download them at http://www.xmlblaster.org/xmlBlaster-win-dll-1.4-15829M.zip. Then create a VC++ 8.0 project for Smartphone or PocketPC or Windows Mobile and compile Hello.cs, TestPInvoke.cs or your own client.


Example message delivery

The following screenshot shows the connection properties (jconsole server side) from a Psion Workabout Pro running Windows CE 4.2 with a Intel XScale StrongARM 400 MHz processor.

It is connected over WLAN to a Linux box on which the xmlBlaster server is running.
At the time of the screenshot there were almost a quarter million messages delivered with a throttled publish rate of 12 messages/sec (the publisher runs on a Linux box). The latency (sending one message and receiving a ACK for it) is ~7 milliseconds.

Example for a Windows CE client connected to xmlBlaster

The test finished with one million messages send to the PDA without any problems.

Example for a Windows CE client connected to xmlBlaster


These configurations are tested:

No. OS Compiler xmlBlaster Thread library Protocol library XML library Date Author Comment
1 Windows XP VC++ 8.0 1.4+ pthread 2.7.0 SOCKET protocol.socket requirement - 2006-11-28 Marcel If you need compressed communication please use zlib 1.2.3
2 Linux CE g++ 4.1 1.4+ Linux pthreads SOCKET protocol.socket requirement - 2006-11-28 Marcel If you need compressed communication please use zlib 1.2.3 libc 2.4

NOTE: Configuration parameters are specified on command line (-someValue 17) or in the xmlBlaster.properties file (someValue=17). See requirement "util.property" for details.
Columns named Impl tells you if the feature is implemented.
Columns named Hot tells you if the configuration is changeable in hot operation.

See CODE HelloWorld.c
See CODE XmlBlasterAccessUnparsed.h
See http://sources.redhat.com/pthreads-win32/
See http://www.gzip.org/zlib/
See REQ client.c.socket
See REQ protocol.socket
See REQ client.c.queue
See REQ client.csharp
See REQ interface
See TEST TestMethods

This page is generated from the requirement XML file xmlBlaster/doc/requirements/client.c.windowsCE.xml

Back to overview