[fpc-devel] Issue with Critical sections

Vinzent Hoefler JeLlyFish.software at gmx.net
Wed Apr 4 15:13:43 CEST 2007


On Wednesday 04 April 2007 12:59, Sergei Gorelkin wrote:

> But EnterCriticalSection/LeaveCriticalSection also exist in Windows
> API. And they are implemented in System unit without changing names.
> Therefore, to make my code cross-platform, I have only to remove
> Windows from uses clause - then cross-platform versions from System
> unit will be used. This is fine.

No. If you want to be cross-platform just do not use the "Windows" unit 
at all. Rather only use the functionality provided by the system unit, 
regardless of the compilation target.

The "Windows" unit should generally only included if you write platform 
specific code and such code should be separated in its own include file 
or even unit anyway.


Vinzent.




More information about the fpc-devel mailing list