LCL without Lazarus lazarus / 31-LCL ---------------------------------------------------------------------- SomeoneOpenedTheDoor · 2011-06-29 18:17 Hello! I haven't using the Free Pascal for a too long time. I use Delphi since 2006. But now I must use the Free Pascal. So, I want to create a GUI, and I think the LCL is the best choice. But I don't want to use the Lazarus. Can I download only the LCL somewhere? Or, can you help me, how to get it out from the Lazarus? Thank you! ---------------------------------------------------------------------- Arbee · 2011-06-29 18:26 You are not forced to use Lazarus.  The Free Pascal compiler can also be used from the command line. ---------------------------------------------------------------------- SomeoneOpenedTheDoor · 2011-06-29 18:32 The Lazarus' too heavy. I need something lighter (under 200 MBs or 100 MBs). I don't want Graphical Form Designer or anything. I only want the LCL and the Free Pascal. Because I've tried the WinAPI, but it was  And I can't find any libraries/frameworks/etc. which don't need DLL install or require Lazarus 0.9.x.y. I've chosen the LCL because it doesn't need DLLs and the end-user won't need to isntall anything. ---------------------------------------------------------------------- Arbee · 2011-06-29 18:37 Then you can download the complier only. http://www.freepascal.org/download.var But you will need to get Lazarus temporarily if you want to use the LCL.  It stands for Lazarus Component Library, so is it not surprising that it is in combination with Lazarus. ---------------------------------------------------------------------- Martin_fr · 2011-06-29 18:53 If the goal is only to create a small application, but you have a PC that can run Lazarus, then create your app in Lazarus (it will spare you some headache getting all  the include path etc right) Don't use the form designer. create your forms in code TForm.CreateNew; TLabel.Create .... Or better TCustomForm, TCustomLabel..... Those do not have published sections => so you save all the RTTI for them. That may save a bit of size in the end Note, if you use the LCL (even outside Lazarus) you still want to get rid of all RTTI. There is also a compiler switch, or directive, that you may be able to use (sorry not sure what it is). Then you can recompile the LCL, and make sure no RTTI is used. No RTTI, also may improve smart linking. Anything that is published cannot be smart linked away => so even if you use the LCL outside Lazarus, you must take steps to reduce size (search wiki / google) Also you can search through LCL for initialization sections. E.g the unit "graphics" (or maybe it is units included there like jpg, bmp, png) has/have initialization. And those pull in the entire encoder/decoder for all of those images (that is well over 100 mb in your final app). If you do not use a type of image => remove the initialization... There is a project called KOL (not sure, just IIRC) google, or search wiki) ---------------------------------------------------------------------- SomeoneOpenedTheDoor · 2011-06-29 19:07 @Arbee: I know what LCL means. But the Lazarus' using the Free Pascal then I should be able to you the LCL outside of the Lazarus, just with the Free Pascal. @Martin_fr: Thanks for your long and nice answer. No, the application size doesn't matter. I just want to use the LCL because it's easy-to-use, user- friendly and programmer-friendly. The KOL requires Lazarus. So I've downloaded and installed the Lazarus. I've copied the folder "lcl" into the Free Pascal's (version 2.4.4) folder. I've added the "Forms" into the "uses " section. The compiler said: "Can't open include file: "lcl_defines.inc"". So what can I so? What settings to apply? ---------------------------------------------------------------------- Martin_fr · 2011-06-29 19:26 You need to set up some include dirs (IIRC -Fi) But you better compile the LCL, and the include the path with the resulting ppu files. (I haven't got 100% instruction how to) Easiest is to have Lazarus compile the LCL with your FPC version, and then get the ppu files. Also be aware: In most cases you need to include the unit "Interfaces" You need to pre-compile the correct widgetset (folder interfaces). And make sure the result is found by the LINKER The LCL defines some widgetset stuff as external. It does not actually use the units. So FPC would not even try to find them either. But the linker will need to resolve those symbols. So the files (*.o) must be in the path for the linker. This was done, because smart-linking couldn't always figure what was and wasn't used => yet this way the linker would only include what was really used. Sorry, haven't looked at the details for a long time, so you may need to do some digging on your own there. ---------------------------------------------------------------------- SomeoneOpenedTheDoor · 2011-06-29 19:36 Ok, I've solved THAT problem. Now I have this things, what you've said: "Undefined symbol: "WSxyz". I try to solve this too. Because I think I'm close to the "door". ---------------------------------------------------------------------- SomeoneOpenedTheDoor · 2011-06-29 19:41 Yesss, compile succesful! ---------------------------------------------------------------------- SomeoneOpenedTheDoor · 2011-06-29 20:00 So, the FPC can compile this code Code: [Select]program firstlcl; {$mode objfpc} {$H+} uses  Interfaces; Forms; BEGIN END. But I get a runtime error, running this: Code: [Select]program firstlcl; {$mode objfpc} {$H+} uses  Classes; Interfaces; Forms; type  TForm1 = class(TForm);  private  public  end; var  F: TForm1; BEGIN  F := TForm1.Create(Application);  F.Show; END. It says: "Cannot find window class" Error 1407. Can anyone help me, please? ---------------------------------------------------------------------- SomeoneOpenedTheDoor · 2011-06-29 20:08 Nothing, it's working. Just use this code: Code: [Select]program firstlcl; {$mode objfpc} {$H+} uses  Classes; Interfaces; Forms; type  TForm1 = class(TForm);  private  public  end; var  Form1: TForm1; BEGIN  Application.Initialise;  Application.CreateForm(TForm1, Form1);  Application.Run; END. I did it It's working. Thanks for your help, Martin_fr. If you want, I can explain it here, how to get working the LCL without Lazarus. ---------------------------------------------------------------------- Zoran · 2011-06-30 05:18 Quote from: SomeoneOpenedTheDoor on June 29, 2011, 10:08:54 pm I did it It's working. Thanks for your help, Martin_fr. If you want, I can explain it here, how to get working the LCL without Lazarus. I still don't understand why someone would actually need it, but I can see that one does. So, someone will find this useful, it would be nice of you to explain it. But not here, it will get lost in forum, better create a page in Wiki and put the link here. ---------------------------------------------------------------------- felipemdc · 2011-06-30 10:00 Actually I'd prefer this explanation here instead of in the wiki, because its usefulness is very limited. For the vast majority of users one can simply install the entire Lazarus and ignores the parts that one doesn't want. The cheapest new HDs come with what? 80GB? Even my telephone came with more then 8GB of storage o.O ---------------------------------------------------------------------- SomeoneOpenedTheDoor · 2011-06-30 10:24 @felipemdc: I can understand your point of view. But I made the Wiki page. Sorry :| I haven't seen your reply. Maybe you can chek it out: http://wiki.lazarus.freepascal.org/Using_the_LCL_without_Lazarus I think it's useful. Can I ask? Why don't you release just the LCL without the Lazarus? [Edit] My HD is 1 TB.