tabs ↹ over ␣ ␣ ␣ spaces

by Jiří {x2} Činčura

Using FbNetExternalEngine with Firebird Embedded (in .NET)

2 Sep 2021 1 mins .NET, Firebird

Firebird Embedded is a great edition of Firebird (you can read more about it here) and if you put FbNetExternalEngine into the mix, it becomes crazy powerful tool. But to put it into the mix, one needs to carefully follow few steps to succeed.

These steps are required because the code is jumping between unmanaged and managed world few times – from the .NET application (managed code) the code enters Firebird (unmanaged code) and as Firebird executes functions and procedures it goes back to managed code (and can go back to unmanaged if you use IExecutionContext (and the loop can continue)).

First requirement is that your application has to use same runtime as FbNetExternalEngine. At the time of writing that’s .NET Core 3.1. After .NET 6 is released, in couple of months, it is going to be .NET 6. The reason is that with the current architecture I can’t load two runtimes into one application.

Second, and final, requirement is that you need to start your application without debugger attached. You can attach it later after FbNetExternalEngine was loaded.

And that’s it. These two requirements and you have working .NET/C# functions and procedures in a Firebird “server” running inside your application.

Profile Picture Jiří Činčura is .NET, C# and Firebird expert. He focuses on data and business layers, language constructs, parallelism, databases and performance. For almost two decades he contributes to open-source, i.e. FirebirdClient. He works as a senior software engineer for Microsoft. Frequent speaker and blogger at www.tabsoverspaces.com.