[fpc-pascal]When to use pointers with win32
Hans MÃ¥rtensson
hm at os.dk
Tue Nov 26 15:06:40 CET 2002
At 07:51 26-11-02 +0100, you wrote:
>> The following line:
>> waveInThread := CreateThread(0, 0, @waveInProc, 0, 0, @threadID);
>>
>> gives me the compiler error:
>> Incompatible type for arg no. 6: Got VOID_POINTER, expected ULONG
>>
>> whereas the line:
>> waveInThread := CreateThread(0, 0, @waveInProc, 0, 0, threadID);
>> compiles with no errors.
>>
>
>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 I cannot call the original CreateThread API, but only a
Pascal style redefined function (which actually passes the pointer to the
threadID, because the function will set the value for me).
So I still ask for how to find information about the Pascal definitions in
the windows unit.
More information about the fpc-pascal
mailing list