Jump to content

ByteJuggler

Members
  • Content Count

    54
  • Joined

  • Last visited

  • Days Won

    2

ByteJuggler last won the day on October 22

ByteJuggler had the most liked content!

Community Reputation

41 Excellent

Technical Information

  • Delphi-Version
    Delphi 10.2 Tokyo

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. ByteJuggler

    Extremely slow Link phase

    Yes... See if you spot what files, keys, or otherwise handles are being accessed/read/written and whether some stand out as being sluggish, and/or whether some of those events are excessive or slower than normal. Your problem may be inherent to the compiler linking phase and so maybe somewhat unavoidable, but this hypothesis seems dubious since you state that this has begun to be slow and so was previously quick. And generally Delphi really doesn't take long to link. So, something must've therefore changed to cause this one would think. (Random thought: I suppose it's worth checking the underlying disk/filesystem that the VM's virtual disk is on for problems, though I imagine this is fairly obvious and you may well have done this already. Another question, is this in the IDE or via command line compiler? If the former, have you tried the latter? Either direct or via MSBuild which is a easy way to compile a project without having to think about the command line compiler switches?)
  2. ByteJuggler

    Extremely slow Link phase

    Orthogonally to the suggestions from Pawel, I'd suggest also trying to analyse what the step is actually doing while it's "being slow", with ProcessMonitor. Even the built in Windows 10 Resource Monitor, which you can get to from the Task Manager in Windows, can be fairly useful as it allows you to isolate and drill into individual processes to monitor their behaviour as well, including handles/files opened/loaded etc etc. Understanding what it's actually doing and working out why this step is being slow might give you ideas on how to avoid it.
  3. ByteJuggler

    Unit testing cross platform code

    <humour ascerbic="true">This is due to the relationship between "theory" and "practice". In theory there's no difference between theory and practice. In practice, there is. </humour>
  4. ByteJuggler

    Best components for creating windows service apps

    Long time ago yes. But it's quite possible and fairly easy to do mostly what it does (in respect of having a single app that can have GUI or run as service) with just a bit of code rearrangement needed, kind of similar to what aehimself has done. (One service here compiles as APPTYPE CONSOLE/will run as service by default, however it can "convert" itself on startup into a GUI app (which it does by calling FreeConsole() and then creating a main form in the normal way) if it finds a command line switch telling it to do so (e.g. -ui). Otherwise it will start in the normal way as a service app by setting and calling the usual stuff that's called for a service app (e.g. CoInitFlags, SvcMgr.Application.Initialize(), SvcMgr.Application.CreateForm() and finally SvcMgr.Application.Run(). etc)
  5. Hi, Has anyone recently used the ObjectToJSON function from SynCommons.pas from Synopse's mORMot framework? If so can you have a look at the following post: https://synopse.info/forum/viewtopic.php?pid=30271#p30271 It must be me missing something obvious, but it seems slightly broken to me. 🙂 Edit: Never mind! I worked out what I'm missing. You basically have to also add the mORMot unit to your uses clause, to ensure that TJSONSerializer is set as the default writer instead of TTextWriter.
  6. ByteJuggler

    Importing Excel2016 Type library into Delphi

    In case anyone else runs across this thread in the future and are stuck trying to import the type library for MS Word (WinWord.exe), note that unlike with Excel where the type library can be imported from the .EXE file, with WinWord the Type Library is not embedded (it seems) in the .EXE file, so you run into an error if you try the same approach as above. It turns out that for many Office applications the type library information is stored in .OLB files. For more on this see: https://docs.microsoft.com/en-us/office/troubleshoot/office-developer/use-type-library-for-office-from-visual-c-net The full command i used to import the type libraries related to MS Word (WinWord) was: "C:\Program Files (x86)\Embarcadero\Studio\18.0\bin64\tlibimp.exe" -P "C:\Program Files\Microsoft Office\root\Office16\MSWORD.OLB" Adjust as required for the version of Delphi and/or Office you're using. The files will be created in the current folder, so be sure to be in the target folder before you run the command. The output is something like this: C:\temp\import>"C:\Program Files (x86)\Embarcadero\Studio\18.0\bin64\tlibimp.exe" -P "C:\Program Files\Microsoft Office\root\Office16\MSWORD.OLB" Embarcadero TLIBIMP Version 12.16581 [x64] Copyright(c) 1995-2010 Embarcadero Technologies, Inc. Opening C:\Program Files\Microsoft Office\root\Office16\MSWORD.OLB Type library loaded .... Created C:\temp\import\Office_TLB.dcr Created C:\temp\import\Office_TLB.pas Created C:\temp\import\VBIDE_TLB.dcr Created C:\temp\import\VBIDE_TLB.pas Created C:\temp\import\Word_TLB.dcr Created C:\temp\import\Word_TLB.pas C:\temp\import> Hope that helps future me or some other soul... 🙂
  7. Yes, IIRC you're correct. We had to (IIRC) use the .dproj file switch because for whatever reason (bug?) the compiler ignores the compiler directive but does respect the .dproj flag. (To add, in our case the "C++ output file generation" was also already off, however the compiler still emits/emitted this warning from one of the Synopse modules e.g. SynCommons.pas: "'ESynException.CreateLastOSError' with identical parameters will be inaccessible from C++" (and checking the module was being recompiled from scratch.) The only way that worked was the .dproj flag.
  8. You are of course correct. Thanks. I should've looked and thought harder before posting.
  9. I haven't, thanks. I'll try it Monday. (Seems a facepalm is incoming.) Thanks again. 🙂
  10. I have an irritating hint that I'm trying to get rid of ("warning W1036: Variable 'xxx' might not have been initialised" or with initialisation supplied and with project options disabling Assertions the same block of code emits "Value assigned to 'xxx' never used".) The root of the problem is that there's an initializing assignment which sets a variable to zero, followed by some logic, followed by an Assert that checks against the variable. The trouble happens because of the different "Assert" compiler option in force between RELEASE and DEBUG. Under DEBUG mode (for this particular project) "Assertions" are set to True, which means during compilation the Assert() line is not elided (removed), and the compiler therefore (correctly) demands (hints) that the variable being asserted against should be initialised with the first message if not done. Obviously adding an initialising line fixes the hint for DEBUG mode. However, if you then compile the same code in RELEASE mode (for which "Assertions" are set to False), then the Assert() line is elided during compilation. This means the variable initialization is now redundant and then the result is the compiler hint "Value assigned to 'xxx' never used", which (correctly) demands that the initialisation line should be removed. The question is essentially how to fix this so the code can compile successfully without hints both with DEBUG and with RELEASE settings, e.g. both with Assertions enabled and disabled. More concretely, the implication of the above is that to fix this, the initialization code must be conditional and somehow only be included only when assertions are enabled and omitted/removed otherwise, since the initialization is required only if the Assert() check is going to be done. Hence the title of this post and my question: Does anyone know of a compiler directive or something to detect whether assertions are active that will allow me to correctly condition the inclusion of the initialisation assignment so as to eliminate this hint both when Assertions are enabled and disabled?
  11. ByteJuggler

    Importing Excel2016 Type library into Delphi

    Correct.
  12. ByteJuggler

    Importing Excel2016 Type library into Delphi

    No it doesn't appear in that list. And I've by now managed to solve the whole problem, thanks! 🙂 (As far as I can tell 🙂 Oh, and sans designtime component icons but that's hardly important.) I (vaguely) remembered that the Delphi IDE only lists the servers/type libraries/components listed in the 32bit registry, and then managed to (re)locate this page, which states this and mentions that despite the IDE choking on 64-bit imports (as I've found), the TLIBIMP.EXE command line tool works fine. I hence successfully used it to import the Excel 2016 library and built and installed them into the IDE. For reference the command used to import the type library was: "C:\Program Files (x86)\Embarcadero\Studio\18.0\bin64\tlibimp.exe" -P "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE" There's some fiddling required with the output files to make them match Embarcadero's conventions on their own imports (e.g. change from *_TLB.pas to *2016.pas in this instance). You also obviously need to create a Delphi component project to contain the wrapper components, which should be named dclOffice2016.dproj assuming you want to again match Emba's conventions. Inside the project options you should then also set the library suffix to match the product version that you're using and probably set a suitable description. (In my case Delphi Berlin which is product version 24 and suffix 240 as shown here.)
  13. Hi all, I'm trying to import the Excel 2016 type library into Delphi in the normal way via "Component"->"Import Component"->"Import ActiveX Control", click "Add", browse to "C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE" (list changes and has only the selected type lib loaded), "Next>>", filling in the fields as desired, and then clicking "Next >>", Selecting "Create Unit" and clicking "Finish" which then generates the below error ("Error loading type library Excel (Version 1.9).") https://i.vgy.me/DvFI6h.png I've also gone to the trouble of extracting the actual Type Library resource from Excel.exe using Visual Studio and importing that directly instead. (In the above process you select "Import a type library" instead of "Import ActiveX Control".) The result is essentially the same, e.g. the same error is generated. I should note that this is the 64-bit version of Office that is installed, and I'm aware that I've tried to directly import the server/tlb interfaces directly from the 64-bit Excel executable and that this might be part of the problem. I'm unsure whether this is legitimate or whether that's part of the problem, but if this is a problem I'm not sure what I should be importing instead? (Is there some kind of 32-bit wrapper library that I should be importing instead? If so what?) Thanks!
  14. ByteJuggler

    Creating a "pull request" for jvcl

    Ah, I'm sorry you feel a bit burned. 😞 Out of interest and for what it's worth: I had a look at what your patch is for, it seem to me from the StackOverflow discussion that the issue your patch works around is only present in a specific build of Windows and that's there's a fix for it [in Windows] since about a month ago? The maintainers need to respond and state whether this is the case, but it might be that they don't really want to fix OS bugs in the JVCL, an understandable position to take. (Aside, we maintain our own versions of some open source libraries as well as Delphi Source because of similar reasons, being that long ago issues remain unpatched in the official source whether due to lack of interest from the maintainers or lack of demonstrability/completeness/quality/testing or whatever of the issue and/or patch on our end. Sometimes just the way it goes. 🙂 )
  15. ByteJuggler

    Creating a "pull request" for jvcl

    Yes. One of the nice things of open source is that if a project isn't well maintained you can simply "run with it" yourself. Your fork may well eventually become the de-facto official version, if it should turn out that your version of the code in question ends up consistently better maintained and up to date than the original. To be clear: I'm not casting shade at the JCL/JVCL project per se here, just agreeing with your point that there's nothing wrong with maintaining your own fork and the consequences that may have, and that this is sometimes no bad thing. 🙂 Also as a minor digression, while this does obviously require some necessary conceptual branching understanding and how this is handled in git, it's reasonbly easy to create a new feature branch from a master branch even after the fact to fix the "problem" above with multiple pull requests. And it's also of course possible to just roll both sets of changes into a single new pull request. Given that there's some issues with the existing pull request in terms of supported versions (it seems, perhaps?), it seems this may be a fair course of action.
×