<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 25/02/14 12:22, Antonio Fortuny
wrote:<br>
</div>
<blockquote cite="mid:lehqtk$c09$1@ger.gmane.org" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<font face="Helvetica, Arial, sans-serif">Hi Folks.<br>
<br>
Lazarus 1.0.2, FPC 2.6.2, Win32 and Linux x86_64<br>
</font></blockquote>
<br>
<font face="Helvetica, Arial, sans-serif">That's an old Lazarus
version. Did you test with the most recent one?<br>
<br>
</font>
<blockquote cite="mid:lehqtk$c09$1@ger.gmane.org" type="cite"><font
face="Helvetica, Arial, sans-serif"> Something goes wrong with
TRTRCriticalSection. There is a difference between Windows and
Linux.<br>
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.<br>
One critical section looks enough to do the job.<br>
So i code this in Win32 and Linux:<br>
<br>
</font><font face="Helvetica, Arial, sans-serif"><font
face="Helvetica, Arial, sans-serif">Interface uses clause is:<br>
</font>uses<br>
{$IFDEF LINUX}<br>
CThreads,<br>
{$ENDIF}<br>
syncobjs,<br>
{$IFDEF MSWINDOWS}<br>
windows,<br>
{$ENDIF}<br>
{$IFDEF LINUX}<br>
LCLIntf,<br>
{$ENDIF}<br>
Classes,<br>
IdContext,<br>
uSimplelogger,<br>
sitacom,<br>
MessageQ,<br>
autoupdateTCPthread,<br>
sqldb,<br>
SysUtils;<br>
FIniCriticalSection: TRTLCriticalSection;<br>
... <br>
InitializeCriticalSection(FIniCriticalSection);
<----------------- compilation error<br>
...<br>
EnterCriticalSection(FIniCriticalSection);<br>
try<br>
... do a lot of things<br>
finally<br>
LeaveCriticalSection(FIniCriticalSection);<br>
end<br>
...<br>
<br>
On the above line marked as compilation error the compiler
complains with the message<br>
autoupdateserverthread.pas(255,48) Error: Call by var for arg
no. 1 has to match exactly: Got "TRTLCriticalSection" expected
"QWord"<br>
</font></blockquote>
<br>
<font face="Helvetica, Arial, sans-serif">Try putting syncobjs after
LCLIntf in the uses section.<br>
<br>
What you're seeing may be related to bug report
<a class="moz-txt-link-freetext" href="http://bugs.freepascal.org/view.php?id=25187">http://bugs.freepascal.org/view.php?id=25187</a><br>
</font><br>
<blockquote cite="mid:lehqtk$c09$1@ger.gmane.org" type="cite"><font
face="Helvetica, Arial, sans-serif"> <b><big>winapi.inc</big></b>(650,11)
Hint: Found declaration: InitializeCriticalSection(var QWord);<br>
winapi ??? Why on Linux ?<br>
No way to get rid of this compilation error<br>
In Win32 the program compiles and runs without errors.<br>
<br>
Some help would be appreciated.<br>
</font></blockquote>
<br>
<font face="Helvetica, Arial, sans-serif">This is odd. What is the
output of View/IDE Internals/About FPC and About IDE?<br>
<br>
Stephano</font><br>
</body>
</html>