[fpc-devel] Small Wstrings problem
Michael Van Canneyt
michael at freepascal.org
Mon Jun 27 13:14:02 CEST 2005
On Mon, 27 Jun 2005, Florian Klaempfl wrote:
> Martin Schreiber wrote:
>> On Sunday 26 June 2005 20.07, Florian Klaempfl wrote:
>>
>>
>>> I didn't merge the widestring memory handling to fixes and it wasn't
>>> wrong to do so, see the current failures :)
>>
>>
>> They don't work with checkpointer (see bug report 4125).
>
> Anybody a suggestion how we should handle this? There was a bug report
> (http://www.freepascal.org/bugs/showrec.php3?ID=2423) that FPC causes problems
> when working with variants and widestrings and passing them to windows.
In delphi, on windows the function NewWideString calls SysAllocStringlen
to allocate the wide string. On Linux, a simple getmem is used.
When freeing the wide string, SysFreeString is used.
I don't see any other way to do it. To make the code 'system
independent' you could introduce a set of procedural variables
GetWideStringMem : Function (Len : Integer) : Pointer;
FreeWideString : procedure(var P : Pointer);
Which are set to defaults on non-win32, and which are set to 2 functions
that call the appropriate windows functions.
Michael.
More information about the fpc-devel
mailing list