Jump to content

DelphiUdIT

Members
  • Content Count

    822
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by DelphiUdIT

  1. DelphiUdIT

    Start Menu items missing for RAD Studio 12.3

    This can help: https://stackoverflow.com/questions/39371607/inno-setup-start-menu-uninstall-shortcut-is-not-shown-on-windows-10/48771335#48771335 In Windows 11 is the same: not all uninstall program links are show in Start Menu
  2. DelphiUdIT

    Compiler directives for line number?

    With the same function you can get also the procedure name ' TForm1.Button1Click', instead to write it like a constant: GetLocationInfo(ReturnAddress).ProcedureName Think to use a temporary record and call GetLocationInfo only one time.
  3. DelphiUdIT

    Compiler directives for line number?

    May be this can help: https://en.delphipraxis.net/topic/11249-embed-line-number-at-design-time/?do=findComment&comment=89256 P.S:: those work at runtime not like preprocessors directive.
  4. DelphiUdIT

    Define conditional symbol in .dpr

    Yes, I know that, I only responded to @HeartWare about his conclusion. I were not able to find any logic behind that. It's sure that if a file is not listed in the project files, that happen more frequently (like in the example I propose: Unit2.inc is not in the Projects Files list). But since I used the RamDisk, I have less issues (tending towards zero) about that.
  5. DelphiUdIT

    Define conditional symbol in .dpr

    If you want I can make a video ...
  6. DelphiUdIT

    Define conditional symbol in .dpr

    No, not in performance. The advantage is that you don't have to delete the traditional WIN64\Release directory for each individual project. When you erase the disk (1 second), you delete all the temporary directories for all your running projects. And, I have SSD, don't use the disk ....
  7. DelphiUdIT

    Define conditional symbol in .dpr

    I agree with you, same experience. By now I resolved using a RAMDISK where all my projects are set to save the compiled files (DCU). Two times per day I'm sure that the build operation builds all, and a simple erase of the ramdisk forces a complete rebuild.
  8. DelphiUdIT

    Bitmap and TWICImage

  9. DelphiUdIT

    Ask for new account

    Someone have asked for new account in this forum (that is not possible to have now). He has some issues with Delphi and Postgres 15. It's possible in some way to create an new account ? May be send an e-mail ?
  10. DelphiUdIT

    executing code at startup?

    Or you can create a Thread, where you can run every code you need without UI interactions. https://docwiki.embarcadero.com/Libraries/Athens/en/System.Classes.TThread
  11. DelphiUdIT

    FMX Linux - the product and the company

    Yes, they are "alive". And they are working on, but FMX Linux means "FireMonkey X Linux" ... so ...
  12. The getit server is down (or is not working) since Saturday.
  13. Sorry, I understood wrong the question. My fault. It's better thta I wait some more details before speaking ...
  14. You can look at examples posted, they use strings in ShowMessage ....
  15. In the example thay gave, the equivalent expression is a typical IF, so we can deduce that the new expression also behaves in this way: the part not affected by the condition will not be evaluated. Of course, only they or the release can confirm this.
  16. Make a prevision on what they will produce is only a fantasy. I think, 'cause the next is a major release, that will only be the beginning of a series of new features that will be proposed to us. But, ...... if some MVP were authorized to release some other substantial news, even if not seasoned with technical details ....
  17. I don't think so, if you read the full topic you'll see that there is no patch on FPC and they are working on (I don't know how much). May be after the public release of Rad Studio 13 whit all notes they will speed up the production of a patch.
  18. DelphiUdIT

    if Obj <> nil then Obj.Free

    @Eugene Kryukov My only concern was related to the scrupulousness of maintaining the compatibility with the past that ICS still maintains. I don't need proof or anything else. @Anders Melander I was referring to old versions, not ancient versions (I know you meant to point out that the nil test has existed since the first versions of Delphi)
  19. DelphiUdIT

    if Obj <> nil then Obj.Free

    Uhmm, I don't remember how FREE procedure is operational in the old versions of Delphi. If the FREE TObject procedure doesn't test the NIL before destroy it ... So for new Delphi version is OK, but for older you should see.
  20. DelphiUdIT

    Need help investigating an app crash

    I don't know. I worked always like I wrote with 1 thread for ModBus connection. But I had what I show changed at that time, with no comment (my fault ) and there were no pratical reasons to had done this. May be like you said something about multithreading with access to IoHandler, and that only change something obscure ... To do some datas, this week (7 days) a line that works near 8 hours / day have done more than 15 milions of reading (MODBUS) from PLC with only 5 failures and more than 1 milions of writing with no failure (that machine were in test with monitoring all working parameters, also double check about write ModBus register and read back the values).
  21. DelphiUdIT

    Need help investigating an app crash

    About the Connected "property. In my code I used to do this: //PLcBot is TIdModBusClient //THIS IS PRIVATE procedure used ONLY INSIDE A THREAD procedure TPlcComm.fprocBotIP(value: string); begin if PlcBot.Connected then <--- connetcted tested like normaly should be PlcBot.Disconnect; PlcBot.Host := Value; try PlcBot.Connect; except on e:exception do ; end; end; //This is the test connection used OUTSIDE the THREAD, via a READ ONLY property function TPlcComm.fGetPlcConnection: boolean; begin if assigned(PlcBot.IOHandler) then <---- Test CONNECTED used in another way !!! result := PlcBot.IOHandler.Connected <---- else result := false; end; The test about connection state is used in different way if used outside the thread or inside the thread, may be at that time (many and many years ago) there was something wrong about that. It has been working for at least 8 years (this part was last updated almost 8 years ago).
  22. DelphiUdIT

    Need help investigating an app crash

    I use Indy Bundle and the same Modbus component to read a PLC (Encoder conuter) every 10 / 15 ms. and write on them every 150 ms. (EDIT... I do this since 8 years and there are dozen of machines that work in this way 24h/24h). I never had such problem. TAKE CARE that you cannot use Indy (and ModBus too of course) from differnt Threads (you spoke about use it in Main Thread too). Try to modify the logic and work from single Thread (where you can create and use ModBus) ... untill you are sure the Indy operation don't interfer between threads.
  23. @@AT I still think you don't understand the function of Interlocked and how it works. Even in your example, you use loops to verify that the function "succeeds." This is legal if the variables are modified by other threads and you enter that "loop" indefinitely until the variables assume an identical value to exit. But since you also mention collisions, I think you actually believe that Interlocks are executed or not based on collisions. That's not the case. It's not a mutex or a semaphore, and it's not a critical section. Interlocked simply protects a memory area from "concurrent" modifications. And note that in reality, most direct memory operations are already intrinsically protected. For example, INTEL guarantees the atomicity of some operations such as direct reading or writing, which involves a register and "byte," word, dword, etc. memory if the memory is aligned. XCHG instructions are also atomic (unlike complex instructions like CMPXCHG) as long as they operate on aligned memory. LOCK can be used on multiple memory-operating instructions to ensure LOCK even in unintended cases (e.g., unaligned memory). Ref: "Intel® 64 and IA-32 Architectures Optimization Reference Manual: Volume 1, April 2024"; Ref: "Intel® 64 and IA-32 Architectures Software Developer’s Manual, March 2025" Caution: Interlocked functions generate a significant delay in instruction execution (i.e., the instruction executes in more clock cycles than normal).
  24. The code with ".CompareExchange" in you example cannot exist in that way. The "unsuccesfull" exchange is not about a collision but a comparison: look at https://docwiki.embarcadero.com/Libraries/Athens/en/System.SyncObjs.TInterlocked.CompareExchange I think you confuse the Interlock with something else. Interlock operations ensure that these are performed SINGLELY in a multithreaded environment (there's no point in using them otherwise). But these operations are ALL ALWAYS performed. The hardware determines how to do it, but it does them all one at a time. The sequence is not and cannot be known in a multithreaded environment. For example, these operations can be used to increment a global counter from multiple threads. If the "target," i.e., the memory to be modified, is the same (since it's the same variable), interlock operations prevent multiple threads from colliding and generating a race condition.
  25. I understand what @@AT means. The entire class-based operation is not "singularized," and from a general perspective, it might seem that the operation's "atomicity" isn't guaranteed. But atomicity concerns ONLY and EXCLUSIVELY the modification of the SRC value, nothing else. And the modification of that value is guaranteed to be atomic via the LOCK. As for its content, nothing can be defined, since if the variables are "constant" or "local," everything is certain, but if all the parts involved are global variables... then their value is definitely not certain at any given time. But here we delve into other topics, involving synchronization techniques, barriers, etc. (and they also exist at the processor instruction level, such as "lfence" other the "lock"). And that is another story like other writers in this topic said.
×