Using PellesC & BCX with Unicode

Using Unicodelexer I can compile the majority of my BCX code for x86 ASCII, x86 Unicode or PPC code with very little effort on my part.

This allows me to test WinCE or Unicode programs on my regular machine without having to resort to emulators etc.

For this you will need the Unicodelexer files and PellesC version 5.0 or above.

A sample Header at the beginning of one of my BCX projects is:

$PELLES

'Comment out all the following ~20 lines for regular ascii X86 code
'NOTE:  change paths and filename to suit your setup
'This header code for both x86 unicode and PPC
$HEADER
#ifndef _UNICODE
    #define _UNICODE
#endif
$HEADER
#include <tchar.h>

'Use next 2 lines to Translate for x86 Unicode
'$ONEXIT "D:\Dev\BCX\XLator\Unicodelexer.EXE D:\Dev\BCX\ThisFileName.c"
'add special include files here
'
'End of specific code for unicode X86

'Use next 2 lines to Translate for PPC
$ONEXIT "D:\Dev\BCX\XLator\Unicodelexer.EXE D:\Dev\BCX\ThisFileName.c -ppc"
$INCLUDE "D:\Dev\bcx\Wince\common\WinCesetup.bas"
'add other PPC only include files here
'
'End of specific code for ppc
'End of non - ascii code

'Start the rest of your code here:


In most cases the above code is all that needs to be changed in BCX code in order to switch between the 3 modes.
 
To compile with PellesC the calls to invoke POCC and POLINK need some minor changes:
I have added some switches to my PellesC.bat to do all this.

Examples of calling PellesC Compiler:


PellesC GUI x86Call  in ASCII


pocc -W1 -Ot -Gd -Go -Ze -Zx -MT -Tx86-coff -D_WIN32_WINNT=0x0501  myFileName.c


PellesC GUI Call in UNICODE


pocc -W1 -Ot -Gd -Go -Ze -Zx -MT -Tx86-coff -D_WIN32_WINNT=0x0501 -DUNICODE -D_UNICODE myFileName.c


PellesC PPC Call in UNICODE

pocc   -Tarm-coff -Zi -W1 -MT -Gd -Ze -Zx -D_WINCE -D_WIN32_WCE=0x400 -DARM -D_ARM_ -DUNICODE -D_UNICODE myFileName.c


Examples of calling PellesC Linker:


PellesC GUI x86 Call in ASCII and  UNICODE


polink  -release -machine:ix86 -subsystem:windows myFileName.obj ResFileName.res kernel32.lib advapi32.lib delayimp.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib %4 %5 %6


PellesC PPC Call in UNICODE

polink -release -machine:arm  -subsystem:windowsce,4.0 myFileName.obj ResFileName.res -stack:0x10000,0x1000 -version:1.1  aygshell.lib coredll.lib corelibc.lib commctrl.lib


For more on using UnicodeLexer see my page at:
http://www.starpig.com/IDC1/BCX/IDC_BCX_Page.html

I hope this is useful to others

Ian