Page 1 of 1

PB 4.51f x86 Size of character in resident is fixed

Posted: Thu Oct 07, 2010 9:37 pm
by technicorn
Using PB V4.51 final on XP 32bit

There seem to be a bug in the creation of resident files with the size of characters (.c) in structures.
If you use such structures, the size of .c stays as the compiler setting of ascii / unicode generated code when the resident file was created.

Code: Select all

Structure MyChar
  c.c
EndStructure
If you make this into a resident file, restart the compiler and than use this:

Code: Select all

Debug SizeOf(MyChar)
It always show 1 if the resident was compiled with unicode 'off', and 2 if unicode was 'on', independent of the unicode setting for the above test.

In the structure viewer it will show as:

Structure MyChar
c.c
EndStructure

just like the predefined 'Character' structure of PB, but this will show the correct size of the structure.
It's also a problem when you use structures like this:

Code: Select all

Structure MyCharVector
  c.c[0]
EndStructure
The characters are always accessed in address steps of 1 or 2, depending on the unicode setting of the compiled resident, not the actual source code setting.

Only workaround I see at the moment, is to not make files containing such structures into residents, but to include them via XIncludeFile on each compilation.

Might be that .i is also not correctly sized, but I only have 32 bit windows, so I can't check this.

Re: PB 4.51f x86 Size of character in resident is fixed

Posted: Thu Oct 07, 2010 10:21 pm
by freak
You have to create two versions of your resident and put the unicode-specific one in "Residents\Unicode\". The compiler will then load the right one depending on the unicode mode.

Re: PB 4.51f x86 Size of character in resident is fixed

Posted: Thu Oct 07, 2010 11:14 pm
by technicorn
@freak: Many thanks for this fast reply at this late hour
Will change my resident building tool to always create both versions