Question

I was wondering if it's possible somehow to use windows.pas on OS X with Lazarus? I need to use special library in my project, and one of key-files uses windows.pas :( Any ideas?

Was it helpful?

Solution 2

You certainly cannot use Windows.pas under OSX. Because Windows.pas exposes the functionality of the Win32 library.

If you need to execute Win32 code on OSX pretty much your only option is Wine.

A more plausible solution is that you find an alternative to this "special" library to which you refer.

OTHER TIPS

Windows.pas only works on Windows. You will have to edit the library to put an IFDEF around it in the uses clause, and then provide alternatives for any functionality that is then broken. Or contact the library author and see if there is already a non-Windows version available.

Windows.pas is mostly a wrapper around different DLLs contained in the Windows operating system. As it is unlikely that you will find those DLLs in OSX I guess you are out of luck.

You could check the library's source code and try to identify the constants, procedures and functions that are used in windows.pas. If it is not too much code you could try to modify the library so that it uses corresponding Carbon functions instead.

While the various answers are correct, and the vast bulk of unit windows is not portable, some functionality IS abstracted. Structures like interlockedincrement, Rect and ColorRef, and some message related functionality. Have a look at types and lcltype and the system unit interface of FPC.

A lot of Delphi code still uses Windows for that functionality, while e.g. unit types already exists since D6.

Some other things are abstracted, but not using the same (windows unit) calls. Better explain what exactly you need in a separate post.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top