[fpc-pascal] how to pass a unicode string pointer in Mac OSX

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Jan 26 09:00:36 CET 2009


On 26 Jan 2009, at 09:48, Guru Kathiresan wrote:

> In windows wchar_t size is 2 so I thought I can pass a WideString type
> casted with PWideChar.
>
> In Mac ,size of wchar_t is 4 in the C library and the size of  
> WideChar in
> FPC is 2.
>
> In that case how do we convert the 2 byte WideChar to 4 byte wchar_t  
> string?

You can use this function from the system unit:
function WideStringToUCS4String(const s : WideString) : UCS4String;

And for the other way around:
function UCS4StringToWideString(const s : UCS4String) : WideString;


Jonas



More information about the fpc-pascal mailing list