[Lazarus] Codetools question

Michael Van Canneyt michael at freepascal.org
Sat Oct 10 12:43:12 CEST 2015



On Sat, 10 Oct 2015, Ondrej Pokorny wrote:

> On 10.10.2015 12:35, Michael Van Canneyt wrote:
>> 
>> Hi,
>> 
>> Mainly for Mattias, I suppose:
>> 
>> The SetString routine in the system unit has become a compiler procedure in 
>> 3.0:
>> 
>> {$ifdef FPC_HAS_CPSTRING}
>> Procedure fpc_setstring_ansistr_pansichar(out S : RawByteString; Buf : 
>> PAnsiChar; Len : SizeInt; cp: TSystemCodePage); rtlproc; compilerproc;
>> {$else}
>> Procedure SetString(out S : AnsiString; Buf : PAnsiChar; Len : SizeInt);
>> {$endif}
>> begin
>>   SetLength(S,Len);
>> {$ifdef FPC_HAS_CPSTRING}
>>   SetCodePage(S,cp,false);
>> {$endif}
>>   If (Buf<>Nil) then
>>     fpc_pchar_ansistr_intern_charmove(Buf,0,S,0,Len);
>> end;
>> 
>> This means the codetools are no longer able to find the SetString 
>> declaration.
>> 
>> Is there any way to fix this kind of things (i.e. find compiler procs) in 
>> the code tools ?
>
> Yes, see TIdentCompletionTool.GatherPredefinedIdentifiers() in 
> IdentCompletionTool.pas
>
> Add this line there:
>
>    AddCompilerProcedure('SetString','out 
> S:RawByteString;Buf:PAnsiChar;Len:SizeInt;cp:TSystemCodePage');

Oh cool :-)
I didn't know this existed, I keep underestimating the Lazarus IDE ;)
How to detect the compiler version ? Because it is only for 3.0+, I suppose.

Michael.




More information about the Lazarus mailing list