R: Re: [fpc-pascal] Mac osx callback functions parameters: wrong values in 386 mode.

fpanasiti at tiscali.it fpanasiti at tiscali.it
Tue Sep 7 16:08:07 CEST 2010


Thank you very much for your help.

Regards
Francesco

----Messaggio originale----
Da: jonas.maebe at elis.ugent.be
Data: 06/09/2010 18.13
A: "fpanasiti at tiscali.it"<fpanasiti at tiscali.it>, "FPC-Pascal users 
discussions"<fpc-pascal at lists.freepascal.org>
Ogg: Re: [fpc-pascal] Mac osx callback functions parameters: wrong 
values	in 386 mode.


On 06 Sep 2010, at 17:21, fpanasiti at tiscali.it wrote:

> Using control callback function with a control (a button) 
apparently 
> results in wrong 
> parameter values when compiling to 386 (values are correct 
compiling 
> to ppc).

The default calling convention on non-i386 platforms is mostly the 
same as the C calling convention. On i386, it's different for Delphi 
compatibility. Add the "mwpascal;" modifier at the end of the function 
declaration to get the same calling convention behaviour as with 
MetroWerks Pascal (that's also the calling convention expected by the 
declarations in the macosall unit).

>    lControlActionUPP:= NewControlActionUPP(ControlActionProcPtr
> (@myActionProc));

By adding an explicit typecast you make it impossible for the 
compiler to tell you that the routines are incompatible. Remove the 
ControlActionProcPtr typecast, and if you are using MacPas mode then 
also remove the "@". The compiler will then give an error if the 
callback's signature is wrong, and it will also print the signature of 
the expected type.


Jonas_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal





Risparmia con Tutto Incluso Light: telefono + adsl 8 mega a soli 19,95 € al mese per un anno!SCONTO DI 120 EURO! http://abbonati.tiscali.it/telefono-adsl/prodotti/tc/tuttoincluso_light/?WT.mc_id=01fw



More information about the fpc-pascal mailing list