Tuesday, May 22nd

Last update:11:17:57 AM GMT

Headlines:
You are here: Windows Mobile News STLPort and Windows Mobile

STLPort and Windows Mobile

STLPort and Windows Mobile

Compiling and using STLPort for Windows Mobile 5.0. Compiling and using STLPort for Windows Mobile 5.0. I think not reveal any great secret when I say that ships with Visual Studio 2005 version of STL for Windows Mobile is very cut off, if not more. Unfortunately, ready-made solution how to compile STLPort for Windows Mobile is also not visible. In this article I will discuss a few simple steps, allowing STLPort compile and use it in the projects.

I see the latest at the time of this writing version STLPort 5.1.4. You can download it from here would be: http://sourceforge.net/project/showfiles.php?group_id=146814&package_id=162032&release_id=544939 So, after downloading, source code, they should say to unzip the folder C: \ Include. For simplicity, we introduce a small variable STL_PATH, which would mean the installation path (where you extracted the files) STLPort. In my case it is C: \ Include \ STLport-5.1.4. To compile STLPort change to the directory STL_PATH \ build \ lib. Create a simple bat-file, which will allow us to run cmd in the current directory:

rem command.bat
cmd
rem end bat

For those who do not know, lines starting with rem - a comment.

Then, create WinMobile.bat, which will set the basic parameters of the compilation - the type of processor, the path to header files, static libraries and other binaries (such as the compiler).
In my case, Microsoft Visual Studio 2005 installed on the path: C: \ Program Files \ Microsoft Visual Studio 8, and Windows Mobile 5.0 Pocket PC SDK at: C: \ Program Files \ Windows CE Tools \ wce500 \ Windows Mobile 5.0 Pocket PC SDK . These addresses are standard, and you almost certainly, they are the same. So, imagine bat-file:

rem WinMobile.bat
cls
set OSVERSION = WCE500
set PLATFORM = Windows Mobile 5.0 Pocket PC SDK
set TARGETCPU = ARMV4I
rem disable buffer security check
set CL = / GS -

set CC = cl.exe
set VSINSTALLDIR = C: \ Program Files \ Microsoft Visual Studio 8
set SDKROOT = C: \ Program Files \ Windows CE Tools

set PATH =% VSINSTALLDIR% \ VC \ ce \ bin \ x86_arm;% VSINSTALLDIR% \ VC \ bin;% VSINSTALLDIR% \ Common7 \ IDE;% PATH%
set PLATFORMROOT =% SDKROOT% \% OSVERSION% \% PLATFORM%

rem add libs and includes from the SDK
set INCLUDE =% PLATFORMROOT% \ include \% TARGETCPU%
set LIB =% PLATFORMROOT% \ lib \% TARGETCPU%

rem add libs that came with VC8
rem Note: there are more libs and includes under ce \ atlmfc, not sure if these are needed.
set LIB =% LIB%;% VSINSTALLDIR% \ VC \ ce \ lib \% TARGETCPU%

rem end WinMobile.bat

Now, the preparatory stage is completed and you can begin the process of compiling. Two clicks on command.bat run the console. And introduce a sequence of commands:

  1. Setting environment variables for compilation under Windows Mobile
    > WinMobile
  2. Configuring. evc8 - compiler Visual C + + 8.0 for Windows CE.
    configure-c evc8-x
  3. Kernel compilation
    nmake / fevc.mak
  4. Installing compiled libraries (copy them to STL_PATH \ Lib)
    nmake / fevc.mak install

So, now it is up to small, not shutting down the console (if you had time to close again the first 2 points), Compile unit tests and run them to check how correctly we employ STLPort:

> cd .. \ test \ unit
> nmake / fevc.mak install

For successful compilation had to comment out the file C: \ Include \ STLport-5.1.4 \ test \ unit \ cwchar.cpp
/ * # if defined (WCHAR_MAX) & & (WCHAR_MAX <= USHRT_MAX)
/ / Do nothing, this is test for macro expansion
# endif * /

Now compiled test applications lie in STL_PATH \ bin
You can try to run tests on the desktop machine does not get: after all, Intel does not ARM. On the device, too uninteresting: the console application. So to run on the device we need the console driver, download it here: PocketConsole http://www.symbolictools.de/public/pocketconsole/download.htm
Thus, to PocketConsole normally worked under Windows Mobile 5.0 is set to 0 registry key HKEY_LOCAL_MACHINE \ Drivers \ Console \ OutputTo

Everything is now possible to copy and test. There you can download the cmd for Pocket PC and write tester batch file, which displays the results of testing in result.txt:
rem test.bat
stl_test_unitd_static.exe-f = result.txt

Now you need to prescribe the way in Visual Studio, so she used STLPort. To do this, open the Options dialog box, Project and Solutions => VC + + Directories. In the drop-down list on the left select the desired platform: Windows Mobile 5.0 Pocket PC SDK, and the right, select Include. Adding to the very beginning of the path to the header files STLPort: STL_PATH \ stlport.