Patterns · Tips & Tricks · Uncategorized

Mapping Delphi Types to Indices at Compile Time

Say what now? In this post I will show you how you can use generics and class variables to generate unique incrementing indices for any Delphi type. For example, the Integer type could map to index 1 and the TStream type to index 2 etc. The values of these indices will be determined (partially) at… Continue reading Mapping Delphi Types to Indices at Compile Time

Foundation · Libraries · Tips & Tricks · Uncategorized

Using Static Libraries and Assembly with 64-bit macOS

We show how you can use Delphi’s new 64-bit macOS compiler toolchain to link 3rd party static libraries and your own assembly code. We also look into some common linking errors you may run into and how to fix them. LLVM based Compiler and Linker Like all recent Delphi compilers, the new Delphi compiler for… Continue reading Using Static Libraries and Assembly with 64-bit macOS

Foundation · Optimization · Tips & Tricks · Uncategorized

Allocation-Free Collections

Say you have a method that creates a temporary list to gather some data. You calculate some statistics based on that data and then you destroy the list again. You call this method a lot, resulting in lots of memory allocations and deallocations and increased memory fragmentation. In addition, all this memory management takes time… Continue reading Allocation-Free Collections

Communications · Tips & Tricks · Uncategorized

iOS and macOS App Extensions with Delphi

In this article we are going to cover how to package iOS and macOS Application Extensions with your Delphi developed iOS and macOS application and interact with the Application Extension from Delphi using the Application Groups API. Introduction There are numerous features on iOS and the Mac that are only available using Application Extensions. App… Continue reading iOS and macOS App Extensions with Delphi

Optimization · Tips & Tricks · Uncategorized

Inline Variables can increase performance

Delphi 10.3 Rio will add inline variables to the language. Besides the various benefits mentioned in Marco’s blog post that introduces the concept, inline variables can potentially improve performance of your code. It’s all about scope If you have been reading my articles, then you may know that I am a sucker for performance. That’s… Continue reading Inline Variables can increase performance

Libraries · Tips & Tricks · Uncategorized

Chet – A C Header Translator powered by Clang

In my previous post on libclang for Delphi, I mentioned an obvious use case for libclang: to build a (better) C-to-Pascal header converter. I also suggested I may provide such a tool in the future. Well, the future is here and I put my money where my mouth is. The result is Chet, a sort of… Continue reading Chet – A C Header Translator powered by Clang

Foundation · Tips & Tricks · Uncategorized

Using Apple’s Grand Central Dispatch and Android’s ScheduledThreadPoolExecutor for Delphi timers

You are probably already familiar with the NSTimer on iOS/macOS and JTimer on Android for timer events. In addition to the basic timers, most operating systems offer a more advanced threaded schedule event API. On Android there is the ScheduledThreadPoolExecutor which allows you to launch a Runnable at a specific time period. On iOS/macOS the… Continue reading Using Apple’s Grand Central Dispatch and Android’s ScheduledThreadPoolExecutor for Delphi timers

Tips & Tricks · Uncategorized

Alternative Dark Editor Themes for Delphi 10.2.2

We conclude Grijjy’s first blog year with a non-technical post for a change. We present two alternative color schemes for the text editor of the Delphi IDE that work well with the new dark theme that has been introduced with Delphi 10.2.2. I absolutely love Delphi’s new dark IDE theme and icon designs. It is… Continue reading Alternative Dark Editor Themes for Delphi 10.2.2

Libraries · Tips & Tricks · Uncategorized

Face Detection on Android and iOS

Android and iOS have built-in support for detecting faces in photos. We present a small platform-independent abstraction layer to access this functionality through a uniform interface. You can find the source code on GitHub as part of our JustAddCode repository. Like we did in our post on Cross Platform Text-to-Speech, we expose the functionality through a Delphi… Continue reading Face Detection on Android and iOS