[Lazarus] TRTLCriticalSection

Antonio Fortuny a.fortuny at sitasoftware.lu
Tue Feb 25 12:14:04 CET 2014


Le 25/02/2014 12:04, Sven Barth a écrit :
> Am 25.02.2014 11:22, schrieb Antonio Fortuny:
>> Hi Folks.
>>
>> Lazarus 1.0.2, FPC 2.6.2, Win32 and Linux x86_64
>> Something goes wrong with TRTRCriticalSection. There is a difference 
>> between Windows and Linux.
>> In a program which will run on Win32 and Linux x86_64, using threads 
>> and all this stuff I need to protect some code from multi-threading 
>> access.
>> One critical section looks enough to do the job.
>> So i code this in Win32 and Linux:
>>
> [snip]
>> On the above line marked as compilation error the compiler complains 
>> with the message
>> autoupdateserverthread.pas(255,48) Error: Call by var for arg no. 1 
>> has to match exactly: Got "TRTLCriticalSection" expected "QWord"
>> *winapi.inc*(650,11) Hint: Found declaration: 
>> InitializeCriticalSection(var QWord);
>> winapi ??? Why on Linux ?
>> No way to get rid of this compilation error
>> In Win32 the program compiles and runs without errors.
>>
>> Some help would be appreciated.
> The function for initializing a TRTLCriticalSection is 
> InitCriticalSection, not InitializeCriticalSection. If you wouldn't 
> use the Windows unit you'd have seen this error on Windows as well.
The windows unit is used in the Win32 box (look at the conditional uses 
clause)

Antonio;
>
> @Michael: maybe we should add a seealso for the 
> Init-/Enter-/Leave-/DoneCriticalSection functions to the documentation 
> of the TRTLCriticalSection type.
>
> Regards,
> Sven
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus



---
Ce courrier électronique ne contient aucun virus ou logiciel malveillant parce que la protection avast! Antivirus est active.
http://www.avast.com






More information about the Lazarus mailing list