Recent

Author Topic: Windows.pas in Lazarus?  (Read 14299 times)

warleyalex

  • New Member
  • *
  • Posts: 24
Windows.pas in Lazarus?
« on: January 05, 2008, 03:02:30 am »
Hi,
In kylix, I successful compiled "Windows.pas" unit from Delphi source, but unfortunately this units call
kernel.dll and user32.dll (GUI API for Win32).
I would like to do this: In my kylix application has a component called "tdbf" installed, but when i
compile/run the application, there's reference to windows.dcu and Messages and so.

and in Lazarus? You can compile units where require Windows.pas?
I would like a unit "Windows.pas" working in Linux enviroment, I don't know, Lazarus can compile such unit.
Lazarus is superior to Kylix?

Regards,
warleyalex

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: Windows.pas in Lazarus?
« Reply #1 on: January 05, 2008, 03:12:41 am »
Kylix is a dead project, Lazarus is growing up.

warleyalex

  • New Member
  • *
  • Posts: 24
RE: Windows.pas in Lazarus?
« Reply #2 on: January 05, 2008, 05:49:37 pm »
Kylix has a great compiler.

bee

  • Sr. Member
  • ****
  • Posts: 392
RE: Windows.pas in Lazarus?
« Reply #3 on: January 05, 2008, 07:36:52 pm »
Don't you get it? The unit name has implied it already. How can you expect a windows unit to be able to run on non-Windows OS? On Linux, please use the linux unit. :P

FPC is also a great compiler. In cross platform term, FPC beats Kylix/Delphi up very well. :D It's just a matter of you want to clear your mindset and adapt yourself with cross platform object pascal, or not (and be ready to stuck yourself on windows). :P
-Bee-

A long time pascal lover.

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: RE: Windows.pas in Lazarus?
« Reply #4 on: January 05, 2008, 09:17:36 pm »
Quote from: "antonio"
Kylix is a dead project, Lazarus is growing up.


I don't think this was a helpful answer.

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: Windows.pas in Lazarus?
« Reply #5 on: January 05, 2008, 09:23:58 pm »
Quote from: "Dr.osama"

and in Lazarus? You can compile units where require Windows.pas?

You can on windows, but the windows unit is for interfacing with windows dll's.
Quote
I would like a unit "Windows.pas" working in Linux environment, I don't know, Lazarus can compile such unit.

Why? There are no windows dll's in Linux. Most of the functionality is in other more high level units like sysutils. More or less equivalent (i.e. tied to the OS) units for *nix are the unit unix and baseunix. But in your case you don't need to worry about that, because TDBF is distributed with fpc for linux, freebsd and mac os x, so the TDBF developer has found out how to replace the windows unit on these OS-es.

Further, for some graphical support functions from the windows unit, the LCL provides the LCLIntf unit, but I don't think you need those in your case.
Quote
Lazarus is superior to Kylix?

Yes.  :)

antonio

  • Hero Member
  • *****
  • Posts: 605
RE: Re: Windows.pas in Lazarus?
« Reply #6 on: January 06, 2008, 03:11:13 am »
Quote from: "Vincent"
I don't think this was a helpful answer.


Sorry, Vincent.

Quote
Lazarus is superior to Kylix?

Yes.  :)


It is just what I wanted to say.

Quote
Kylix has a great compiler.


Borland compilers are very good.

warleyalex

  • New Member
  • *
  • Posts: 24
RE: Re: Windows.pas in Lazarus?
« Reply #7 on: January 06, 2008, 06:57:54 pm »
If Lazarus could do this... it would the Best for Linux Programming!
*********************************************************
It's very interesting what Borland kylix compiler does.
I successful compiled "Windows.pas" in Kylix environment without errors, ok.
The problem is "KERNEL.DLL" and "USER.DLL" - the main Win32 API couldn't be called in Linus OS.
When you compile one project with Windows uses, such program ask for this libraries.
If i could emulate this libraries like in WINE in Linux or Kernel.so or User32.so emulating this winapi libraries. The Kylix would be "THE KILLED RAD FOR LINUX" because the compatiblity with Delphi it would be barely 100%. If could emulate BDE it would be 99,99%.

It's possible call kernel.DLL outside of Wine using an application running natively in Linux?

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
Re: RE: Re: Windows.pas in Lazarus?
« Reply #8 on: January 06, 2008, 07:04:23 pm »
Quote from: "Dr.osama"
If Lazarus could do this... it would the Best for Linux Programming!
If it could do this, it was not be design, but maybe you are lucky and it is possible.

I think you have to rethink your porting strategy.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
RE: Re: RE: Re: Windows.pas in Lazarus?
« Reply #9 on: January 06, 2008, 07:20:28 pm »
I agree with Vincent. The porting strategy you are trying is completely wrong. Instead of trying to use the Windows API inside Linux you need to use cross-platform functions provided by Free Pascal / Lazarus / other libs. Start reading the wiki and ask again more if you have specific questions.

http://wiki.lazarus.freepascal.org/Multiplatform_Programming_Guide

http://wiki.lazarus.freepascal.org/Lazarus_Documentation

Also, many corner cases where specific winapi functions have no easy replacement on fpc/lazarus were already asked on this forum, so take some time to search it too when you hit a problem.

Zaher

  • Hero Member
  • *****
  • Posts: 581
    • parmaja.com
RE: Re: RE: Re: Windows.pas in Lazarus?
« Reply #10 on: January 07, 2008, 01:08:02 am »
It is not fair when comparing Lazarus/FPC with Kylix or Delphi
First Kylix is deferent application from Delphi ,you need to redesign the forms or convert between its forms by tools, because there is many properties not found between Kylix and Delphi.
Also in Kylix you must use (For example) QForms for Kylix and in Forms unit in Delphi for that you need to use IFDEF always in your code, i think Kylix it is bad strategy to move to Linux systems from delphi, and for that it is dead.
Lazarus it is real cross compile, "One code compile any where".