[fpc-pascal] Using AnsiString/WideString with C Library
gmjimen at burdjia.com
gmjimen at burdjia.com
Mon Jun 4 14:02:19 CEST 2007
Hello.
I'm writing a wrapper for a C library that allows the use of UNICODE. I did
wrappers for C libraries but using only ASCII strings. I did:
UNIT example;
INTERFACE
PROCEDURE Proc (Text: ANSISTRING);
IMPLEMENTATION
{ Wrapper for the C function. }
PROCEDURE _C_Proc_ (Text: PCHAR); CDECL; EXTERNAL 'lib.dll' NAME 'proc';
PROCEDURE Proc (Text: ANSISTRING);
BEGIN
_C_Proc (PCHAR (Text));
END;
END.
This way I can use Pascal strings with C functions.
I've read the documentation and I find that I can use WIDESTRING in a similar
way, but I'm not sure which character codification WIDESTRING uses. The C
library uses 'standard C strings' (that is 'char *string;') an there's a
function to define the character codification to be used by the library. It's
possible to use ASCII, UTF-8, UTF-16 and UTF-32.
Can WIDESTRING use all UNICODE codifications and ASCII strings?
If it can't, is there a way to use UNICODE strings?
Thanks in advance.
Guillermo Martínez Jiménez
[p.s.] Por cierto, escribo tonterías y hago budujos que podéis ver y
leer aquí --> http://dibujantemomar.deviantart.com/
y aquí --> http://dibujantemomar.spaces.live.com/
More information about the fpc-pascal
mailing list