New Dotnet 7.0 has beautful NativeAot without GetDelegateForFunctionPointer :D

Posted 3 weeks ago2023-05-03 14:08:25 UTC
DeafMan1983 DeafMan1983C# Developer and Linux Creator
Hello everyone sorry longer busy because I was sick and I have stress of my work.

I develop own Half-Life Sharp for x64 only
User posted image
I have tried to communicate with native library like Engine.so, Client.so and Server.so
User posted image
User posted image
How did I get modern delegate with unmanagable way successfully?

Since I get message by Jan Kotas, and I get link to FunctionPointer

Example:
Before for MonoGame FuncLoader.Desktop.cs
return Marshal.GetDelegateForFunctionPointer<T>(ret);
Now delegate unmaged<....>
Example:
....

[DllImport(dl)]
private static extern void *dlsym(void *so_handle, sbyte *func_name);

....

public static delegate *<string[], sbyte *, int, delegate* unmanaged[Cdecl]<sbyte *, void>, int> pfnMain_p_new;

....

        pfnMain_p_new = (delegate *<string[], sbyte *, int, delegate* unmanaged[Cdecl]<sbyte *, void>, int> )dlsym(hEngine, StringFromHeap("Host_Main"));
        if (pfnMain_p_new == null)
        {
            Console.WriteLine("Unable to pass function name {0}", GetError());
        }
....
And you can download for C# If you have to use SDL3 and ConversionFunction for sbyte * and string.

Enjoy your development with Half-Life in C#, compile as NativeAot and run it. :D I know we can develop Vulkan and modern OpenGL and also WASM EGL :-D

Comments

You must log in to post a comment. You can login or register a new account.