[Lazarus] Creating packages - what to include?

Werner Pamler werner.pamler at freenet.de
Mon Dec 28 18:31:54 CET 2020

You are talking of runtime code only. Here are instructions how to 
create a Lazarus runtime package (I never created an FPC package...): Go 
to "Package" > "New package", specify name and location of the new 
package, an empty package will be created automatically. In the package 
editor which opens right-click on "Files" and add all the files which 
are supposed to be contained in the package. When the units that you 
need depend on other units found in other packages you must add these 
other packages to the node "Required Packages" (right-click, "Add"). 
Then click "Compile". When everything is correct, go to "options" in the 
package editor, and in "IDE Integration" select "Runtime package". This 
means that the package is not installed into the IDE. Save, of course.

In order to use this runtime package in a project, open the Project 
Inspector, right-click on "Required Packages" and select your new 
package to be added to the project tree. Now you can "use" all units of 
this package.

When you are on a new Lazarus installation the IDE does not yet know 
your package. Go to "Package" > "Open Package File (*.lpk)". That's all 
to be done so that the IDE knows the path to the package. When you 
compile your project the package will be compiled as well. Of course you 
can click "Compile" also in the Package Editor to make sure that your 
package is correct in the new installation. There is no need to click 
"Use" > "Install" for a runtime package.

Coming from Delphi you may be tempted to extend the unit path by the 
path to your package units. Do not do this - you will have lots of 
trouble. The Lazarus package concept does not require you to set any paths.

More information about the lazarus mailing list