[fpc-pascal]When to use pointers with win32

Jonas Maebe jonas at zeus.rug.ac.be
Tue Nov 26 16:18:39 CET 2002


On dinsdag, nov 26, 2002, at 15:06 Europe/Brussels, Hans MÃ¥rtensson 
wrote:

>> That is because the CreateThread() with C calling is accidently 
>> removed
>> from the windows unit.
>>
> As far I can see, your explanations are wrong, because the CreateThread
> function is documented in then win32.hlp as to require as the 6th 
> parameter
> an 'address of returned thread identifier'. But the lines
>
> var pthreadID: ^cardinal;
> ...
> waveInThread := CreateThread(0, 0, @waveInProc, 0, 0, pthreadID);
>
> gives the compiler error:
> Incompatible type for arg no. 6: Got ^ULONG, expected ULONG
>
> whereas the lines:
>
> var threadID: cardinal;
> ...
> waveInThread := CreateThread(0, 0, @waveInProc, 0, 0, threadID);
>
> compiles with no error.

This shows that what Peter said above is correct: the Pascal version 
(where the sixth parameter is a "var threadid: cardinal") is there, but 
the C version (where the sixth parameter should be "threadid: 
^cardinal") is missing.


Jonas




More information about the fpc-pascal mailing list