Recent

Author Topic: Avoid automatic file saving when starting program  (Read 4952 times)

440bx

  • Hero Member
  • *****
  • Posts: 6073
Re: Avoid automatic file saving when starting program
« Reply #15 on: July 02, 2025, 11:06:30 am »
I think it would be very nice to have a service that compiles.

That way, the compiler doesn't need to be loaded for every compile.  The compiler could be "shoehorned" into being suitable as a service but, it would be much nicer if the compiler's code allowed for it to be installed as a service.

That way, at least in theory, it would be possible to do multiple compilations in parallel.  For instance, if the project has multiple release modes, then "Run->Compile many modes" could conceivably use one service per mode.  One way to put those cores to good use. :)
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #16 on: July 02, 2025, 11:10:04 am »
I wonder if it is also possible to "integrate" the compiler into Lazarus, as a package?
Theoretically: yes, based on the same information I provided.

About Delphi: the 32 bit compiler comes as a dll for the ide and dccXXX for the commandline. Both use the same dll (has not always been the case, though). All other platforms work through cross-compilers, just like Lazarus does now, and suffer therefor from the same limitations. The Delphi IDE itself is still firmly win32 windows although there is "being worked on".

If you accept the same limitations Delphi has but minus the win32 tie(after all FPC does not suffer from that), there is otherwise no reason why it can't be done. It can be done and fp is proof.
« Last Edit: July 02, 2025, 11:26:59 am by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

RayoGlauco

  • Full Member
  • ***
  • Posts: 223
  • Beers: 1567
Re: Avoid automatic file saving when starting program
« Reply #17 on: July 02, 2025, 11:26:42 am »
it would be much nicer if the compiler's code allowed for it to be installed as a service.

I think it could be an option. I wouldn't want to be forced to install the debugger as a service. In my case, I use Lazarus on computers where I can't install software, and I need Lazarus to remain portable.
To err is human, but to really mess things up, you need a computer.

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #18 on: July 02, 2025, 11:28:22 am »
I think that is a bad idea because services/daemons need controllers for all input/output and that would possibly be quite heavy. And defeats the purpose of a service/daemon. Possibly only feasable for win32 and older windows versions that do not rely on code signing for services or manual rights management.
(What you already can do is run ppc as a cgi on a local or remote webserver)

I think it is a good idea to split-up the thread.
« Last Edit: July 02, 2025, 11:40:50 am by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

440bx

  • Hero Member
  • *****
  • Posts: 6073
Re: Avoid automatic file saving when starting program
« Reply #19 on: July 02, 2025, 11:51:17 am »
I think that is a bad idea because services/daemons need controllers for all input/output and that would possibly be quite heavy.
Not if it's implemented correctly.  It would be extremely efficient, much, much faster than creating a new process for every compilation.  The communication with the services can be done using memory mapped files... everything in memory = very, very fast.

« Last Edit: July 02, 2025, 11:57:42 am by 440bx »
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #20 on: July 02, 2025, 12:35:33 pm »
The communication with the services can be done using memory mapped files... everything in memory = very, very fast.
Linux won't allow that and win64 won't allow that too afaik.
Sometimes you are too win32 centric, although you have a huge bag of knowledge.
The case is ownership of memory and execution ring. In modern OS's the mapped memory is isolated and you can not use it for communication.
« Last Edit: July 02, 2025, 12:40:26 pm by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

440bx

  • Hero Member
  • *****
  • Posts: 6073
Re: Avoid automatic file saving when starting program
« Reply #21 on: July 02, 2025, 01:15:41 pm »
I have no idea what can and cannot be done in Linux, therefore I'm staying away from that one.

In Windows, there is no problem at all using memory mapped file in services.  No problem using them for communication with other processes.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #22 on: July 02, 2025, 01:39:25 pm »
Unless I am mistaken, your development is still firmly rooted in Win32, not Win64 nor e.g. Linux?
And that is a niche, nowadays. (And rather permissive)
My point is that memory mapping can't be shared without explicit permissions in modern OS's of which 32 bit windows is not one. There is a reason for that: isolation.
« Last Edit: July 02, 2025, 01:43:51 pm by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

440bx

  • Hero Member
  • *****
  • Posts: 6073
Re: Avoid automatic file saving when starting program
« Reply #23 on: July 02, 2025, 01:43:36 pm »
I've left Delphi 2 behind.   I develop everything on Win64 but, whenever possible, I still make sure the code runs in 32 bit if needed.
FPC v3.2.2 and Lazarus v4.0rc3 on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #24 on: July 02, 2025, 01:45:10 pm »
Fair enough. Then share code for a win64 service that shares memory with a user space app and does not need any raised permissions? Because that is what you are implying.
If you can, I stand corrected, but you likely can't.
And if you can't most others can't either....I will give you that..

Ah, I see, if the service defines that the user group can access defined shared memory, then the user can access that memory without elevation. (But the service needs to adapt SID and DACL for that so the memory doesn't have SYSTEM only.)
BUT I would use pipes or sockets instead.

So it is possible, but you may introduce a security violation.
Although I found a C++ example, I won't use such code.
That said: according to MS it does not violate its best practice.
« Last Edit: July 02, 2025, 02:07:04 pm by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4673
  • I like bugs.
Re: Avoid automatic file saving when starting program
« Reply #25 on: July 02, 2025, 04:12:33 pm »
That way, at least in theory, it would be possible to do multiple compilations in parallel.  For instance, if the project has multiple release modes, then "Run->Compile many modes" could conceivably use one service per mode.  One way to put those cores to good use. :)
I think that starting parallel processes is more realistic. Actually it would be very realistic without this FPC feature/bug.
  https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40986

Without the bug the "Compile many Modes ..." menu item in Lazarus could take care of it, instead of starting many LazBuild instances.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #26 on: July 02, 2025, 04:23:55 pm »
Let's split the discussion in two:
1. avoiding saves
2. compiler integration like fp (the textmode ide) has into Lazarus.
They are frankly only remotely related.
« Last Edit: July 02, 2025, 04:25:59 pm by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4673
  • I like bugs.
Re: Avoid automatic file saving when starting program
« Reply #27 on: July 02, 2025, 05:28:07 pm »
Let's split the discussion in two:
1. avoiding saves
2. compiler integration like fp (the textmode ide) has into Lazarus.
... and 3. parallel compilation.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Avoid automatic file saving when starting program
« Reply #28 on: July 02, 2025, 05:52:16 pm »
fpc packages can already be compiled over multiple threads.
Just in case you forgot...
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

PascalDragon

  • Hero Member
  • *****
  • Posts: 6315
  • Compiler Developer
Re: Avoid automatic file saving when starting program
« Reply #29 on: July 03, 2025, 09:31:29 pm »
- The FreePascal textmode IDE has an integrated compiler, so it is not completely unlikely this can be done for Lazarus.
How is it done? The compiler must then be in a form of a library with an API and linked to the IDE.

The text mode IDE directly uses the units of the compiler. And there isn't much API besides "compile file xyz" and some hooks for feedback.

 

TinyPortal © 2005-2018