The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,862 other subscribers

Archive for the ‘Delphi’ Category

Some links on Delphi compiler potential speed improvements…

Posted by jpluimers on 2021/11/04

A long time ago, there was an interesting blog post referenced from [WayBack] See how you can use Delphi’s upcoming new language feature to improve performance of your code. – Erik van Bilsen – Google+ referred to [WayBack] Inline Variables can increase performance – grijjy blog which made me comment [WayBack] “given the potential performance improvements the compiler already could do, and how long they could have been done, I would not bet on these new improvements becoming reality anytime soon.” that I later backed up with these links:

One of the observations there is that since Delphi 2005, no major compiler speed improvements have been done, and that even between Delphi 5 and 2005 mot much has been done either.

From my point of view, the – not so big – Delphi compiler team is very busy keeping balls up in the air supporting the many compiler targets and architecture changes that have been introduced over the past decade or so, that they do not have resources to improve code generation other than rely on the LLVM tool chain (which is not used for Windows x86 and x64 development that covers like 90+% of the Delphi users).

In my book, when you need an “inline var”, you usually want to refactor that bit of code into a separate method anyway.

Refactoring out parts of code that have implicit try/finally blocks for managed variables or records is a strategy that can improve execution speed in many Delphi applications anyway, especially if that piece of code is outside of the happy flow: it moves unneeded overhead out of that flow.

This is actually a strategy used for instance in the Spring4D library: Stefan Glienke has a very good insight in how the compiler works and did magic to some performance critical code paths there.

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

Word for Mac 2011: create macro or shortcut to ‘Insert Picture – Microsoft Community

Posted by jpluimers on 2021/11/02

As it combines VBA and AppleScript, I might need the script from this in the future [WayBack] Word for Mac 2011: create macro or shortcut to ‘Insert Picture – Microsoft Community.

–jeroen

Posted in Development, Office, Office 2011 for Mac, Office Automation, Office VBA, Scripting, Software Development | Leave a Comment »

EProgrammerNotFound exception in Delphi? – Stack Overflow

Posted by jpluimers on 2021/10/19

From a long while my answer to [WayBack] EProgrammerNotFound exception in Delphi? – Stack Overflow (I added the WayBack links)

It was introduced in Delphi 2009, still present in Delphi 2010, and [WayBack] recently got some [WayBackmore attention on the [WayBackinternet.

I think it is an easter egg, similar to [WayBack] “EBCAK” (Error Between Chair and Keyboard), and the [WayBack] skipping of Delphi version number 13.

[WayBack] EProgrammerNotFound

  • is declared in the Win32 branch of the SysUtils unit, but not used anywhere in the RTL or VCL
  • is not present in Delphi Prism
  • was introduced in Delphi 2009, so not present in VCL.NET
  • has currently (version 3.5) nothing similar in the .NET framework (not sure why, these guys [WayBack] do have humour)

I don’t think EProgrammerNotFound is actually meant to be used at all, but since it is there, people will jokingly use it (similar like putting a stray “const False = True; True = not False;” in someone elses sourcecode).

On green bits and red bits (which I highly associate with the “green wobbly bit”:

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

The Charlie Calvert “Here’s to Good Friends and New Adventures” article

Posted by jpluimers on 2021/10/14

Since this contains a list of contains from back then (20+ years ago!), I save it for future reference: [WayBack] Here’s to Good Friends and New Adventures

I would like to make a very short list of the other people at Borland who I have had the privilage of working with very closely. These people are Jason Sprenger, Xavier Pacheco, Steve Teixeira, John Kaster, Lar Mader and Rich Jones. Each of these people I worked with every day over a period of years, and they never showed me anything but the very best and most admirable human traits. I hope I am so lucky as to work with such fine people again in my life.

As for all the others, there is no way even to begin to thank them. A few of these people are Karen Giles, Lino Tadros, Steve Trefethen, Christine Ellis, Paolo Ciccone, Yolanda Davis, Blake Stone, Bruneau Babet, Dave Marancik, Anders Ohlsson, Dave Powell, Claudio Briceno, Joe Manzone, Terri Bartos, Dave Wilhelm, Andrea Ginsberg, Jason Vokes, Ludo Neveu, Martin Pamdeth, Martin Raim, Ernesto Franchini, Edwin Desouza, Zack Urlocker, Rosemary Abell, Robert Warren, Scott Bussinger, Richard Morris, Paul Beach, Jeremy McGee, Nimish Vora, Michael Swindell, Lorie Hull, Kendyll Upstrom, Kari Gallant, Allen Bauer, Josh Dahlby, Jose Rubens, John Thomas, John Williams, J.D. Hildebrand, Hizo Jozsef, Goran Kallmark, Ben Riga, George Cross, Gary Benner, Fred Felman, Erik Jakowitz, Danny Thorpe, Craig Farrell, Claudia Currie, Bill Weber, Lance Devon, Robert West, Amber Hein, Richard Kubat, Jeff Peters, Ellie Peters, Krystyna Niedzwiedzka, Kathy Berkland, Kelly Welty, Tom Lam, Nester Miranda (and Carlos!), Dana Kaufman, Pawal Ksiezyk, Jim Wright, Lori and Ellen from travel, Sergey Orlik and many others who I just don’t happen to recall right now, or who I liked very much but only met a few times.

I’m also indebted to Ray Kanopka, Mark Miller, Dick Malley, Dan Horn, Taco Oosterkamp, Bob Swart, Ann Lynnworth, Marco Cantu, Jeroen Pluimers, and many more who worked in the Borland community and brought me great joy. It’s amazing to consider how many talented and remarkable people have been drawn to this company.

jeroenhttps://www.facebook.com/groups/137012246341854/permalink/2895795467130171/

Posted in Borland C++, C++, C++ Builder, Delphi, Development, Pascal, Software Development, Turbo Pascal | Leave a Comment »

www.fmxrtl.com – BiDi support for Firemonkey

Posted by jpluimers on 2021/10/12

www.fmxrtl.com – BiDi support for Firemonkey

[WayBack] Wayback Machine

Arabic, Hebrew in FireMonkey!

Don’t you wanted to use the fastest development environment, to make an for middle east?

Now it is possible to create an app in Arabic, Hebrew, or Farsi) with Delphi FireMonkey for all environments.

–jeroen

Posted in Delphi, Development, FireMonkey, Software Development | Leave a Comment »

The Delphi Open Tools API Book 1.1 – Dave’s Development Blog

Posted by jpluimers on 2021/10/07

[WayBack] The Delphi Open Tools API Book 1.1 – Dave’s Development Blog

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »

Howto create C-Header for Delphi/Free Pascal/Lazarus DLL – data types – Stack Overflow

Posted by jpluimers on 2021/09/23

From a long time ago, but got a request for it a while ago is [WayBack/Archive.is] Howto create C-Header for Delphi/Free Pascal/Lazarus DLL – data types – Stack Overflow:

I have used the below construct to generate header files compatible with the C-mode compiler of Visual C++ 6 from Delphi 5 code when Delphi had the -JPH switch (see notes below).
Note that I have not used this since Delphi 5, but the switch has since then been expanded:
Somewhere along the line, the [WayBackJPHNE switch has been added to the dcc32 command-line compiler:
  -JPHNE = Generate C++ .obj file, .hpp file, in namespace, export all
It certainly does not handle all types, and you will need quite a bit of [Archive.isHPPEMIT and [Archive.isEXTERNALSYM directives.
It generates the .hpp files to import the DLL that was written in Delphi.
Notes from the Delphi 5 era:
{ Visual C++ 6 does not like nested structs/unions the way that BC++ can handle them.
  Visual C++ 6 requires the "typedef" to be present AND the typename AFTER the struct definition.
  You will see this when defining TConversationId, TReturnKey and other types that depend on nested structs/unions

  The trick is to perform these steps each and every time this unit changes:
    - Generate this unit once with all the EXTERNALSYM disabled.
      - Then the DCC32 -JPH will generate the basic structs for them.
    - Copy all the nested struct and union definitions to this file
    - Embed the definitions with (*$HPPEMIT '' *)
    - Append the typename at the end of the struct definition
    - Enable all the EXTERNALSYM again
    - Regenerate the HPP files by using DCC32 -JPH
  To make this process easier, we have introduced two new conditional defines:
    - BCB - disable EXTERNALSYM, disable HPPEMIT
    - VC6 - enable EXTERNALSYM, enable HPPEMIT

  A similar thing is with these constructions that VC6 does not like those either:
    - short strings (BCB defines them as "SmallString<##>" which VC6 does not like).
    - short integers (BCB defines them as "Shortint" so we have included an HPPEMIT for that)
}

{$ifdef win32}
  { important! Makes sure that the all enumerated types fit in exactly one byte each! }
  {$Z1}

  { force the C/C++ HPP header files to have the C/C++ compiler pack structure elements on byte boundaries }
  {$ifdef BCB}
    {$HPPEMIT '#pragma option push -a1' }
  {$endif BCB}
{$endif win32}

And the download (hopefully I have converted it to git by then):

The link to the converter is now [Archive.is] bitbucket.org/jeroenp/wiert.me/src/default/Native/… – Delphi Coder

–jeroen

Posted in Delphi, Delphi 5, Development, Software Development | Leave a Comment »

Some links that might help use SonarQube with Delphi

Posted by jpluimers on 2021/08/31

For my link archive:

--jeroen

Posted in Delphi, Development, Software Development, SonarQube, Static Code Analysis | 2 Comments »

Some links on Flux outside React.js

Posted by jpluimers on 2021/08/24

The Flux architecture is often used in ReactJS, but there are also implementations outside that realm.

So here are some links for my archive:

–jeroen

Posted in .NET, C#, Delphi, Development, JavaScript/ECMAScript, ReactJS, Scripting, Software Development | Leave a Comment »

delphi – How to embed the MIDAS.DLL in the client executable – Stack Overflow

Posted by jpluimers on 2021/08/17

I hardly use the [WayBack] TClientDataSet Class any more, so every once in a while I bump into a legacy project that does.

Often that forgets provide a deployment list, so usually with deployment of the underlying DLL is forgotten.

Those moments, it slips my mind that the original name for the underlying DataSnap technology is called MIDAS, and the DLL is MIDAS.DLL. Sometimes even a wrong version of that DLL is distributed (unicode versus non-unicode still can still be a thing).

You can avoid loading it (often at a premium of reduced speed) my adding MidasLib to the uses list of any unit in your project:

When you use BPLs instead of full units, then missing this can lead to a nasty access violation like this one where the ClientDataSet cannot be created because the wrong Midas.dll (non-unicode) was loaded, see the screenshot and stack overflow below.

Lessons re-learned:

  1. Use a minimal deployment footprint
  2. Ensure your test systems are clean, so no older versions of dependencies can be loaded at any time.

OS EAccessViolation at adress 5110E007: Access violation at address 5110E007 in module 'dsnap250.bpl'. Read of address 00000000
{occured in main thread}

Stack:
[50060B13]{rtl250.bpl  } System.@HandleAnyException
[00404815]{GVS.exe     } FastMM4.CalculateHeaderCheckSum$qqrp29Fastmm4.TFullDebugBlockHeader (Line 9098, "FastMM4.pas" + 1)
[50060039]{rtl250.bpl  } System.@AfterConstruction
[00404815]{GVS.exe     } FastMM4.CalculateHeaderCheckSum$qqrp29Fastmm4.TFullDebugBlockHeader (Line 9098, "FastMM4.pas" + 1)
[00404824]{GVS.exe     } FastMM4.UpdateHeaderAndFooterCheckSums$qqrp29Fastmm4.TFullDebugBlockHeader (Line 9108, "FastMM4.pas" + 1)
[004057C6]{GVS.exe     } FastMM4.DebugGetMem$qqri (Line 9649, "FastMM4.pas" + 42)
[00405817]{GVS.exe     } FastMM4.DebugGetMem$qqri (Line 9686, "FastMM4.pas" + 79)
[5005A247]{rtl250.bpl  } System.@ReallocMem
[50065674]{rtl250.bpl  } System.DynArraySetLength
[50065715]{rtl250.bpl  } System.@DynArraySetLength
[5110D001]{dsnap250.bpl} Datasnap.Dbclient.TCustomClientDataSet.CreateDSBase
[51111571]{dsnap250.bpl} Datasnap.Dbclient.TCustomClientDataSet.CreateDataSet
[500E920D]{rtl250.bpl  } System.Rtti.TValue._op_Implicit
[00559D29]{CDSDemo.exe } MainDataModuleUnit.TMainDataModule.DataModuleCreate (Line 50, "MainDataModuleUnit.pas" + 1)
[5016E7EF]{rtl250.bpl  } System.Classes.TDataModule.DoCreate
[5016E69C]{rtl250.bpl  } System.Classes.TDataModule.AfterConstruction
[50060039]{rtl250.bpl  } System.@AfterConstruction
[5016E67A]{rtl250.bpl  } System.Classes.TDataModule
[00544941]{CDSDemo.exe } MainFormUnit.TMainForm.PageControlChange (Line 30, "MainFormUnit.pas" + 19)
[0054598B]{CDSDemo.exe } MainFormUnit.TMainForm.FormShow (Line 40, "MainFormUnit.pas" + 47)
[50C075DD]{vcl250.bpl  } Vcl.Forms.TCustomForm.DoShow
[50C0BF7D]{vcl250.bpl  } Vcl.Forms.TCustomForm.CMShowingChanged
[5005FD9F]{rtl250.bpl  } System.TObject.Dispatch
[50AC4C16]{vcl250.bpl  } Vcl.Controls.TControl.WndProc
[50AC97FB]{vcl250.bpl  } Vcl.Controls.TWinControl.WndProc
[50C080B5]{vcl250.bpl  } Vcl.Forms.TCustomForm.WndProc
[50AC4850]{vcl250.bpl  } Vcl.Controls.TControl.Perform
[50AC8B71]{vcl250.bpl  } Vcl.Controls.TWinControl.UpdateShowing
[50AC8C80]{vcl250.bpl  } Vcl.Controls.TWinControl.UpdateControlState
[50ACB9D6]{vcl250.bpl  } Vcl.Controls.TWinControl.CMVisibleChanged
[50AC4C16]{vcl250.bpl  } Vcl.Controls.TControl.WndProc
[50AC97FB]{vcl250.bpl  } Vcl.Controls.TWinControl.WndProc
[50C080B5]{vcl250.bpl  } Vcl.Forms.TCustomForm.WndProc
[50C0E597]{vcl250.bpl  } Vcl.Forms.TScreen.GetMonitor
[50C094C5]{vcl250.bpl  } Vcl.Forms.TCustomForm.SetWindowToMonitor
[50AC4850]{vcl250.bpl  } Vcl.Controls.TControl.Perform
[50AC31E6]{vcl250.bpl  } Vcl.Controls.TControl.SetVisible
[50C078C1]{vcl250.bpl  } Vcl.Forms.TCustomForm.SetVisible
[50C11DCF]{vcl250.bpl  } Vcl.Forms.TApplication.Run
[004B3B28]{CDSDemo.exe } VclApplication.TApplication.Run (Line 113, "VclApplication.pas" + 1)
(00161097){CDSDemo.exe } [00562097]

–jeroen

Posted in Delphi, Development, Software Development | Leave a Comment »