Libraries · Tips & Tricks · Uncategorized

Wrapping C(++) APIs with Custom Managed Records

Delphi 10.4 introduced Custom Managed Records. In this post we show how you can use this new language feature to wrap third party C(++) APIs in an easy to use model. We also compare this method to some other ways you may have interfaced with C(++) in the past. Ways to interface with C(++) For… Continue reading Wrapping C(++) APIs with Custom Managed Records

Optimization · Tips & Tricks · Uncategorized

Boost Mac performance with Metal and Delphi 10.4

Is your Mac app a little unresponsive or does it feel sluggish? Does your MacBook laptop turn into a lap-heater when running your app? Then the new Metal support in Delphi 10.4 may be just the thing for you and your customers! I have been given permission by Embarcadero to blog about this new feature… Continue reading Boost Mac performance with Metal and Delphi 10.4

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 · Libraries · Uncategorized

A YAML Library for Delphi

YAML has become a quite popular human-readable data serialization language. Unfortunately, there aren’t many Delphi libraries that provide tools for it. I hope to fill this void with Neslib.Yaml, a personal project build on top of LibYaml that provides support for parsing and generating YAML documents and streams. LibYaml Bindings Neslib.Yaml uses LibYaml to perform… Continue reading A YAML Library for Delphi

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

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

Foundation · Libraries · Uncategorized

Query JSON documents with JSONPath

We have extended our JSON and BSON library with functionality to query JSON documents using an XPath-like query language called JSONPath. About JSONPath JSONPath is to JSON what XPath is to XML. It enables you to search for data in a JSON document using a simple query language somewhat similar to XPath. Although there is… Continue reading Query JSON documents with JSONPath

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