September 9, 2011
Earlier I wrote that there are a lot of things which are, compared to Delphi, better implemented in Lazarus. One of those things are projects and packages.
It always puzzled me why Delphi stores part of the project information not in the project-file (.dproj) but in the source-file (.dpr.) The information of which units are part of the project, and their location is not stored inside the project, but within the source. So every unit you add to the project will be added to the main project source, even if there is no need to. Vice versa only units in the main project source are available in the project manager.
Lazarus, on the other hand, stores this information in the project settings file, as it should. So you do not need to adapt the source code to add a unit to the project. In this settings file (.lpi) all project-settings are stored. But if you want you can specify to store session-specific information into a separate .lps file. This is useful when you are using a revision control system like subversion or git.
Lazarus and Delphi both support build-modes, to switch easily between different project and/or compiler settings. But what I really miss in Delphi is to add dependencies on packages. In Lazarus you can use the Project Inspector to see which packages the application needs. On opening the project the IDE will check if those dependencies are available and warn if they are not. Additionally it will add the unit-output location of the dependencies to the search-path of the project. This way you don't have to alter the search-path manually for every package that you use. It also makes it easier to switch to another working-environment, since it doesn't matter at which location the compiled-unit files of those packages are stored. As long as the package is installed, the right path will be added. And when one of the source-files from a packages is updated, the package will be re-compiled automatically when the project is compiled. Also if the package is not yet compiled for the specific target you are compiling for, the package will be compiled for that target automatically. If you want to do something similar in Delphi, you'll have to add the package-sources to the search path of your project, which results in compiled version of the units in those packages all over the place...
Packages can also push other settings to projects that depends on them. This can be used for example to add some compiler defines when a package is being used in a project. In short: working with projects and packages dependencies in Lazarus makes project-maintenance a lot easier.
But, to be fair, there is also something that Delphi has that Lazarus hasn't: project groups. With these groups you can handle a group of packages easily within the Project Manager. Now you could argue that these groups aren't really needed when you can add dependencies on packages in projects. But it could be very useful if you are building a server/client application and want to switch between the client and server project very easily. So we'll have to wait for someone who is so annoyed by the lack of this in Lazarus, that he or she implements it...
Both Delphi and Lazarus have some sort of macro's which can be use in the project settings. In Delphi there are the 'system variables' like '$(BDSCOMMONDIR)' which can be used in the search paths. You can change and add these system variables. This can help in those situations that you do not know what the location of some files is on the current system. Although Lazarus has a better solution to to add the location of compiled units to the search path, as shown above. It also has so-called 'IDE Macros'. They are somewhat similar to Delphi's system variables, but the result of these macro's can depend on some other settings and they support parameters, like '$Ext(unit1.pas)' to get the extension from the file unit1.pas.
The most used IDE Macro's are indefinitely $(TargetCPU) and $(TargetOS), to set the unit-output directory to 'lib/$(TargetCPU)-$(TargetOS)', so that the unit files for each different target are placed in another directory. But there are a lot more of such macros.
There are more differences in project settings between Delphi and Lazarus, but I think I handled the most important ones, especially those who you will encounter when switching from Delphi to Lazarus. And they show some of the nice features that Lazarus has to offer, above the rich feature-set of Delphi.
Your email adress will not be published. The required fields are marked by *
Java-bytecode target added to the Free Pascal compiler.
August 20, 2011
A new target has been added to Free Pascal compiler. It is now possible to compile applications to Java bytecode. This means that these Free Pascal applications can run in a Java Virtual Machine (JVM), so that it can run on any platform that has Java support.
Dutch Pascal conference 2011.
June 12, 2011
After the success from last year, the Dutch Pascal Users Group organizes the second Dutch Pascal Conference on June 18th. Last year it was mainly focused on Lazarus, this year there will also be some topics about Delphi.
-- Alexander Grau, Germany