Re:Sqlite – Most Deployed Database in the World
by jasode on Monday December 24, 2018 @08:38AM
(#18752056)
>Is it impossible to just write a .Net-native library with whatever an API
It's not impossible but the issue is whether it's worth the amount of effort involved. So yes, you can theoretically write the C# code in any way that makes a convenient API for the C# coder.
But when attempting real-world implementations, there are varying degrees of difficulty/maintainability of porting the C code to C#. You want to balance the tradeoffs of minimizing the C# programming code effort and maximizing the leverage of the original C source code. The effort continuum would look something like this:
- easy: unsafe C DLL with C# ADO.NET wrapper (the 'C' source code is mostly unchanged and is leveraged for highest reuse; this is what we have today)
- harder: straight C-to-C# port with extra C# code to provide an ADO.NET wrapper (an automated tool can attempt to transpile most of the C into C# which is followed up by a human programmer to manually fix/code the parts the transpiler couldn't; this effort was attempted in 2009 and the incomplete project was eventually abandoned)
- hardest: C-to-C# total rewrite where the programmer built in an ADO.NET api (or whatever API the C# programmer wants to expose). In this way the original SQLite C source is more of a "specification" rather than an input file to a transpiler.
The "harder" effort which wasn't even 100% complete was abandoned. It means the "hardest" implementation, while technically not impossible, is even more unrealistic for anyone to code and maintain. That last method of C# rewrite has immense costs and would fall further and further behind the original C source code in feature parity and bug fixes.
To answer your question on why there are no alternative implementations: it's because it's a lot of programming work that nobody wants to do.
It's not impossible but the issue is whether it's worth the amount of effort involved. So yes, you can theoretically write the C# code in any way that makes a convenient API for the C# coder.
But when attempting real-world implementations, there are varying degrees of difficulty/maintainability of porting the C code to C#. You want to balance the tradeoffs of minimizing the C# programming code effort and maximizing the leverage of the original C source code. The effort continuum would look something like this:
- easy: unsafe C DLL with C# ADO.NET wrapper (the 'C' source code is mostly unchanged and is leveraged for highest reuse; this is what we have today)
- harder: straight C-to-C# port with extra C# code to provide an ADO.NET wrapper (an automated tool can attempt to transpile most of the C into C# which is followed up by a human programmer to manually fix/code the parts the transpiler couldn't; this effort was attempted in 2009 and the incomplete project was eventually abandoned)
- hardest: C-to-C# total rewrite where the programmer built in an ADO.NET api (or whatever API the C# programmer wants to expose). In this way the original SQLite C source is more of a "specification" rather than an input file to a transpiler.
The "harder" effort which wasn't even 100% complete was abandoned. It means the "hardest" implementation, while technically not impossible, is even more unrealistic for anyone to code and maintain. That last method of C# rewrite has immense costs and would fall further and further behind the original C source code in feature parity and bug fixes.
To answer your question on why there are no alternative implementations: it's because it's a lot of programming work that nobody wants to do.