[fpc-pascal]About order of units...

Michalis Kamburelis michalis at camelot.homedns.org
Sun Aug 31 19:25:35 CEST 2003

L D Blake wrote:

> In reply to your message of August 31, 2003
>>If you have a look at the implementation, you'll quickly find, that 
>>all of the examples you listed in this mail make absolutely _no_ 
> It DOES matter, especially in structures where windows is accessing things as
> an offset from a pointer. Typing something as a 4 byte variable instead of a 1
> or 2 byte one will result in wrong structure sizes causing all kinds of errors
> inside windows where we can't really trace them down... The same is true of
> parameters passed in API calls, hand it 4 bytes instead of 1 or 2 and you've
> just offset the rest of the parameters, causing errors, never mind the
> potential for passing grossly incorrect data... and I'm pretty sure
> that's what I've got going on.
>  L D Blake

No, L.D. Blake, it doesn't matter. Tomas was right. All the things that 
you showed as having bad parameters are _macros_, not _API calls_. This 
is why h2pas generated "LongInt" types for theses parameters. And this 
is also the reason why it doesn't hurt : even if WinAPI docs states that 
some macro takes Byte as parameter (which is just a specification of the 
"proper use of the macro", because in actual C code macro's parameters 
have no assigned type), and in our Windows unit it takes LongInt (and 
than casts it in the implementation to Byte before doing some 
bit-shifts) it will not cause any errors. Because this is a macro: it is 
basically just some utility routine that is written and compiled in 
FreePascal. It is NOT something that is called from some Windows system 
DLLs. So even if we have LongInt parameters where WinAPI Help states 
that these should be Byte - it doesn't hurt, it will not cause any errors.

In response to your next letter (that I just received), I can guarantee 
you that Windows unit IS extensively used and it is tested all the time. 
It is a base unit for many other units in FPC, some of them 
multi-platform, some of them Windows-specific. I simply think you're on 
a bad track suspecting that your problems are originated from some bugs 
in Windows unit.

Michalis Kamburelis
<michalis at camelot.homedns.org>

More information about the fpc-pascal mailing list