Hello,
I'm trying to build a simple DLL that does some math operations for use in C/other native applications, out of code I already have in a C# project. The default .NET 8 AOT compiler gets me to a 1.4 MB DLL, while bflat gets me to 944 KB with just --no-globalization. Since this is just math totalling under 1000 LOC, with no GC needed (allocations done once at init, never after), I was hoping that ideally bflat/the zero runtime would help me get this DLL to under 50KB.
However, when attempting to compile with --stdlib:zero, I get a ton of errors, many being about a few issues:
- error CS0103: The name 'MathF' does not exist in the current context (MathF.Min, MathF.Max, etc)
- error CS0103: The name 'Debug' does not exist in the current context (Debug.Assert, should become nops in release builds anyways)
- error CS0518: Predefined type 'System.Index' is not defined or imported (when indexing an array with
[^1]
- error CS0518: Predefined type 'System.Runtime.CompilerServices.IsExternalInit' is not defined or imported (properties with
{get; private init; })
As well as a ton of these since I've manually optimized my math to use x86 SIMD operations where possible:
- error CS0103: The name 'Avx2' does not exist in the current context
- error CS0103: The name 'Sse' does not exist in the current context
- error CS0246: The type or namespace name 'Vector256<>' could not be found (are you missing a using directive or an assembly reference?)
- error CS0246: The type or namespace name 'Vector128<>' could not be found (are you missing a using directive or an assembly reference?)
I mostly wanted to ask if these errors are expected, and implementing these (mostly basic) operations are outside the scope of Zero, or if there's something I'm doing wrong.
Thanks!
Hello,
I'm trying to build a simple DLL that does some math operations for use in C/other native applications, out of code I already have in a C# project. The default .NET 8 AOT compiler gets me to a 1.4 MB DLL, while bflat gets me to 944 KB with just
--no-globalization. Since this is just math totalling under 1000 LOC, with no GC needed (allocations done once at init, never after), I was hoping that ideally bflat/the zero runtime would help me get this DLL to under 50KB.However, when attempting to compile with
--stdlib:zero, I get a ton of errors, many being about a few issues:[^1]{get; private init; })As well as a ton of these since I've manually optimized my math to use x86 SIMD operations where possible:
I mostly wanted to ask if these errors are expected, and implementing these (mostly basic) operations are outside the scope of Zero, or if there's something I'm doing wrong.
Thanks!