Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-04

help: converting windows API to linux

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bee

Hi all,

I've been trying to convert a Delphi unit to FPC. The problem is the unit utilizes lots of low level windows APIs, such as: VirtualProtect, CreateEvent, CloseHandle, etc. Due my lack of linux low level API knowledge, I hope someone here could show me where to find a complete guide about similar linux API of the windows counterpart, including the description, the parameter lists, the API behavior differences, and which FPC unit should be used (instead of just windows unit).

Or maybe I should just rewrite the whole unit from scratch on linux? :-D

TIA.

-Bee-

has Bee.ography at:
http://beeography.wordpress.com

Reply by email

Michael Van Canneyt
to Bee
Bee wrote 11 lines
Hi all, I've been trying to convert a Delphi unit to FPC. The problem is the unit utilizes lots of low level windows APIs, such as: VirtualProtect, CreateEvent, CloseHandle, etc. Due my lack of linux low level API knowledge, I hope someone here could show me where to find a complete guide about similar linux API of the windows counterpart, including the description, the parameter lists, the API behavior differences, and which FPC unit should be used (instead of just windows unit). Or maybe I should just rewrite the whole unit from scratch on linux? :-D

You should rewrite the whole unit in a cross-platform manner.

Michael.

Reply by email

Michael Van Canneyt
to Bee
Bee wrote 5 lines
> You should rewrite the whole unit in a cross-platform manner. Is it possible? I read somewhere that the behavior API of Windows is pretty much different to API of Linux (and other uni*x platform). Maybe I'll end up writing a specific unit for each platform. :(
You should make abstraction of what this unit tries to achieve;
After that you can see how this can be done in a cross platform manner.

If you just try to re-implement the windows API calls with 'cross-platform' ones, then you are bound to fail... (the createevent etc. is rather specific)

Michael.

Reply by email

Graeme Geldenhuys
to Bee: Is it possible? I read somewhere that the behavior API of Windows is pretty much…
Bee wrote
> You should rewrite the whole unit in a cross-platform manner. Is it possible? I read somewhere that the behavior API of Windows is

Yes it's possible, but nobody said it would be easy. :-) I've done this a few times before. IBM's website had some good documentation on porting Windows apps to Linux etc... The tiOPF project took some time to get cross-platform and cross-compiler compatible, but it's working now.

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Marco van de Voort
to Bee: Is it possible? I read somewhere that the behavior API of Windows is pretty much…
> You should rewrite the whole unit in a cross-platform manner. Is it possible?

There is no general rule. Sometimes you'd have to rewrite significant parts, sometimes it is substituting a few calls.

First try to define what abstract functionality you exactly use, instead of what you use on windows. (because some of the windows functions might have alternative uses not as easily emulated on Windows that you don't actually use)

Reply by email

Guillermo Martínez Jiménez

May be you can use the Wine library. It is a library created to help porting applications from Windows to *NIX. Visit www.winehq.org

Regards.
Ñuño Martínez.

Reply by email