-
Content Count
3711 -
Joined
-
Last visited
-
Days Won
185
Everything posted by David Heffernan
-
You RAD Studio 10.4 Sydney appreciated features and bug fixes
David Heffernan replied to Wagner Landgraf's topic in General Help
On the plus side these can be readily fixed yourself for your programs. I mean, I've been running with a patched RTL for years that fixes all the design flaws in handling of floating point control flags. At least we have access to the RTL source code and so can apply fixes easily using code hooks. -
Front-end vs Back-end question
David Heffernan replied to David Schwartz's topic in Network, Cloud and Web
Depends on all sorts of things. I guess people are finding it hard to get motivated to write it all down. -
Should I separate common units to Public and Internal, or have all Public?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
This sounds like a whole layer of extra complexity for no gain. Frankly I'm not surprised that you seem to find everything so challenging when you choose to introduce layer on layer of complexity. -
Remote control of Word no longer working
David Heffernan replied to Rüdiger Paschotta's topic in VCL
Nah, that's not true.- 10 replies
-
Remote control of Word no longer working
David Heffernan replied to Rüdiger Paschotta's topic in VCL
Automating Word for document preparation is known to be somewhat brittle. More robust is to generate Word documents directly without invoking Word at all. There are good libraries for doing that. That's the point. If you are going to rely on Word for this then it pays to be very careful about the version that you use. Switching to Office 365 is simply asking for trouble.- 10 replies
-
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
OK. I've been working to the definition in the Delphi RTL. -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
Wrong. It returns a Bool, which is LongBool, the 4 byte boolean. The right fix is for Emba to change it to Boolean. -
You can't have read the documentation. Because you aren't calling ShutdownBlockReasonCreate. I know that you want to solve this quickly. But that expectation is unrealistic. It will take you time to wade through this, try it out, read and understand example code, etc. For sure one of us could write you some examples but unless you understand it will you really be able to integrate it into your code? Just because you don't understand this now does not mean that you can't learn it. It just requires self belief and persistence.
-
You aren't doing what the documentation I linked to instructs you to do.
-
Getting notification isn't really what concerns you. You know how to do that. What you need to be able to do is block shutdown until you have finished saving any data. The way that is handled changed in Vista. The documentation you need starts here: https://docs.microsoft.com/en-us/windows/win32/shutdown/system-shutdown
-
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
It's astonishing that Emba's InterlockedCompareExchange128 returns a BOOL, i.e. a 4 byte boolean, LongBool. They are presumably trying to copy this one from MS https://docs.microsoft.com/en-us/windows/win32/api/winnt/nf-winnt-interlockedcompareexchange128 which is actually implemented as an intrinsic. But look at the MS function's return type. Yup, it's BOOLEAN which is a single byte. The Emba version should use Boolean rather than Bool as the return type. It's a screw-up from top to bottom. Anyone might think that they just write this stuff and don't test it ...... -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
SETZ BL XOR EAX, EAX MOV AL,BL Don't you just need SETZ AL MOVZX EAX, AL Also, .NOFRAME is wrong here. You need the frame to preserve RBX. At least that's how I understand it. -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
Has anybody looked at the equivalent for msvc, gcc, clang, etc? -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
I submitted a QP report for InterlockedCompareExchange128 not restoring rbx -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
To me it is much cleaner to comment at the top of the routine which register each parameter travels in, and then stick to registers. That allows you to see teg register usage directly rather than having an extra level of indirection. -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
You are restoring volatile registers there. That's wrong. Most egregious is where you restore rax which has the return value. Ah, i read the bit where you say "the others do nothing". I guess the compiler knows they are volatile / used for param/return passing. I'd remove them all the same. You really must stop using parameter names in asm because it obfuscates the fact they they live in registers, and which ones. -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
Probably remove that +8. But I'm guessing there. I'd never write asm using variable names. You simply have to write the whole thing using registers to keep track of what it where. -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
Wrong. It also lets the compiler out the meta data, the unwind data, needed to restore the register in case of an exception. Read Allen's article. -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
CAS from OTL does restore rbx, but it should do so using .pushnv, for the reasons that Allen's article explains. -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
No it is not. It modifies rbx and does not restore it. -
Record Circular References
David Heffernan replied to Bernard's topic in Algorithms, Data Structures and Class Design
This is the point that I've been making all along. -
Record Circular References
David Heffernan replied to Bernard's topic in Algorithms, Data Structures and Class Design
Not being able to do that one thing would hardly invalidate the entire enterprise. We'd still be able to use the type as procedure argument which is the main thing we are striving for. But the whole argument is predicted on this single pass. It's no big deal to pass over each type section twice to process forward declarations. Won't make a blind bit of difference to performance. Bottom line is that it is perfectly possible to do this if Emba wanted to. -
Record Circular References
David Heffernan replied to Bernard's topic in Algorithms, Data Structures and Class Design
If what you say were true, then class forward references would not exist. -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
I can't see where RBX is restored in that InterlockedCompareExchange128 code. It's a NV register. Function needs to start with .PUSHNV RBX I can't vouch for the rest of what it does. -
Revisiting TThreadedQueue and TMonitor
David Heffernan replied to pyscripter's topic in RTL and Delphi Object Pascal
You can't be doing multithreaded programming where "whilst still not perfect" as a valid statement. It's got to be right.