Recent

Author Topic: Using Lazarus modules in other applications.  (Read 3832 times)

simone

  • Hero Member
  • *****
  • Posts: 648
Using Lazarus modules in other applications.
« on: December 17, 2024, 11:06:17 am »
The Lazarus IDE has some modules (forms) that could be very useful even outside the application itself, for example to develop utilities for the programmer. I'm referring, in particular, to the Project Inspector and CodeExplorer forms. As for the latter, at first glance, it seems to me, however, that it is not simple (perhaps not even possible) to use such a form inside other applications, given the multiple interdependencies with other modules of the IDE.

To avoid a useless effort of in-depth analysis of code, can someone who knows the code base better than me, tell me if this is feasible or not?

Thanks for the usual support.
« Last Edit: December 17, 2024, 11:37:19 am by simone »
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

cdbc

  • Hero Member
  • *****
  • Posts: 1871
    • http://www.cdbc.dk
Re: Using Lazarus modules in other applications.
« Reply #1 on: December 17, 2024, 12:18:29 pm »
Hi
By *no* means am I an expert, but to be able to use these things in another language / tool, you'd have to stuff them into a library and 'C-flatten' the whole 'Shebang'  ...Good luck with that!
I do not think that is feasible.
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

simone

  • Hero Member
  • *****
  • Posts: 648
Re: Using Lazarus modules in other applications.
« Reply #2 on: December 17, 2024, 12:28:54 pm »
I was referring to external applications written in Lazarus.
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

cdbc

  • Hero Member
  • *****
  • Posts: 1871
    • http://www.cdbc.dk
Re: Using Lazarus modules in other applications.
« Reply #3 on: December 17, 2024, 12:38:48 pm »
Hi
Then I think you'll have to wait for 'lpl's to be finished, i.e.: (l)azarus (p)ackaged (l)ibrary
They should be the equivalent of 'Delphi's bpl, I think it's Sven/Sara, who is working on that...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

MarkMLl

  • Hero Member
  • *****
  • Posts: 8234
Re: Using Lazarus modules in other applications.
« Reply #4 on: December 17, 2024, 05:15:01 pm »
Also check the licence situation of the bits of the IDE you covet and their dependencies.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

simone

  • Hero Member
  • *****
  • Posts: 648
Re: Using Lazarus modules in other applications.
« Reply #5 on: December 17, 2024, 09:02:10 pm »
Yes, there is certainly the legal aspect to consider.

But at the moment I'm interested in the technical feasibility and, in this regard, it seems to me that the path is not practicable.
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

cdbc

  • Hero Member
  • *****
  • Posts: 1871
    • http://www.cdbc.dk
Re: Using Lazarus modules in other applications.
« Reply #6 on: December 17, 2024, 10:38:48 pm »
Hi
You could have a 'LookSee' here to see what it entails to put just a form in a DLL...
...and it gets a little bit easier, if you use interfaces, but not much.
If it's just for your own programs, that you create and compile, then the components are all there in the component-palette or in OPM...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

MarkMLl

  • Hero Member
  • *****
  • Posts: 8234
Re: Using Lazarus modules in other applications.
« Reply #7 on: December 18, 2024, 10:31:11 am »
You could have a 'LookSee' here to see what it entails to put just a form in a DLL...
...and it gets a little bit easier, if you use interfaces, but not much.
If it's just for your own programs, that you create and compile, then the components are all there in the component-palette or in OPM...

Interesting. Going slightly OT, I've previously put a design-time form in a .so file and at runtime copied a menu structure from it into the main form. Don't think something like that would help OP, but it was definitely a useful aid to plugin etc. development.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

cdbc

  • Hero Member
  • *****
  • Posts: 1871
    • http://www.cdbc.dk
Re: Using Lazarus modules in other applications.
« Reply #8 on: December 18, 2024, 10:50:25 am »
Hi Mark
Yeah, ok slightly OT, but hey 'Plugins' are in the ballpark of TS' question...
I've made my own plugin framework and just a few days ago, got 'round to implementing 'Modal-Callbacks' in forms, so they work now.
However the debugger sometimes wines about QT been built without debug info, but outside the debugger, 'No Worries'  :D
It's pretty nice, took some doing though, not sure if Simone is up for that  ;)
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

MarkMLl

  • Hero Member
  • *****
  • Posts: 8234
Re: Using Lazarus modules in other applications.
« Reply #9 on: December 18, 2024, 10:55:10 am »
There were lots of fussy little devils in the details, particularly when one started looking at loading and unloading a plugin/backend without disrupting dataflow (a MIDI stream in the stuff in question).

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12050
  • FPC developer.
Re: Using Lazarus modules in other applications.
« Reply #10 on: December 18, 2024, 11:25:21 am »
Note that OP might mean using Lazarus elements in her own lazarus programs, not necessarily in a 3rd party language.

License might come into play in that case too though.


simone

  • Hero Member
  • *****
  • Posts: 648
Re: Using Lazarus modules in other applications.
« Reply #11 on: December 18, 2024, 11:50:54 am »
Thanks for the replies. I didn't know what is reported here: https://wiki.freepascal.org/Form_in_DLL.

In a nutshell: I'm building (with Lazarus) a (freepascal) code analyzer for personal use (at least at the beginning) and it was convenient for me to reuse the CodeExplorer form, instead of reimplementing it by hand. Not too difficult task, using a good parser (like fcl-passrc, with which I'm quite familiar).

However, it seems to me that this is not practically possible, so I proceed with the second approach, i.e. build a custom form by hand.
« Last Edit: December 18, 2024, 01:21:36 pm by simone »
Microsoft Windows 10 64 bit - Lazarus 3.0 FPC 3.2.2 x86_64-win64-win32/win64

440bx

  • Hero Member
  • *****
  • Posts: 5010
Re: Using Lazarus modules in other applications.
« Reply #12 on: December 18, 2024, 12:03:01 pm »
In a nutshell: I'm building (with Lazarus) a (freepascal) code analyzer for personal use (at least at the beginning)
I think that is a very interesting project (one that has crossed my mind a number of times.)

Just curious, do you plan on sharing it ? i.e, make it open source.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

cdbc

  • Hero Member
  • *****
  • Posts: 1871
    • http://www.cdbc.dk
Re: Using Lazarus modules in other applications.
« Reply #13 on: December 18, 2024, 12:05:29 pm »
Hi
However, it seems to me that this is not practically possible, so I proceed with the second approach.
Good on you simone, that will also take care of the licensing issue  ;)
Have fun doing it...
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE5 -> FPC 3.2.2 -> Lazarus 2.2.6 up until Jan 2024 from then on it's: KDE5/QT5 -> FPC 3.3.1 -> Lazarus 3.0

MarkMLl

  • Hero Member
  • *****
  • Posts: 8234
Re: Using Lazarus modules in other applications.
« Reply #14 on: December 18, 2024, 12:55:12 pm »
In a nutshell: I'm building (with Lazarus) a (freepascal) code analyzer for personal use (at least at the beginning) and it was convenient for me to reuse the CodeExplorer form, instead of reimplementing it by hand. Not too difficult task, using a good parser (like fcl-passrc, with which I'm quite familiar).

Good luck with that, and let us (collectively) know if there's anything we can do to help.

My demo program with frontend + backend/plugin is at https://github.com/MarkMLl/dsocat . That doesn't have any GUI-related stuff in the backend, but derives directly from a MIDI filter I wrote years ago which extracts menu entries from the backend so basically all the hooks for loading/unloading are there. Yell if there's anything you think you need.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Logitech, TopSpeed & FTL Modula-2 on bare metal (Z80, '286 protected mode).
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018