diff --git a/cs/net core/EntryPoint.cs b/cs/net core/EntryPoint.cs index 721e484..1151703 100644 --- a/cs/net core/EntryPoint.cs +++ b/cs/net core/EntryPoint.cs @@ -7,6 +7,15 @@ namespace ArmaDotNetCore { public class ArmaExtension { + //You can call back to Arma by using Callback(string name, string function, string data); + public static unsafe delegate* unmanaged Callback; + + [UnmanagedCallersOnly(EntryPoint = "RVExtensionRegisterCallback")] + public static unsafe void RvExtensionRegisterCallback(delegate* unmanaged callback) + { + Callback = callback; + } + //This tells the compiler to create an entrypoint named 'RVExtension'. This line should be added // to each method you want to export. Only public static are accepted. [UnmanagedCallersOnly(EntryPoint = "RVExtension")] @@ -19,7 +28,7 @@ public class ArmaExtension /// A pointer to the memory location of a chars array that will be read after issuing callExtension command /// An integer that determines the maximum lenght of the array /// A pointer to the string passed from arma - public unsafe static void RVExtension(char* output, int outputSize, char* function) + public static unsafe void RVExtension(char* output, int outputSize, char* function) { //Let's grab the string from the pointer passed from the Arma call to our extension //Note the explicit cast @@ -55,7 +64,7 @@ we have to convert it to a byte array in order to allow the arma extension loade /// An array of pointers (char**). IE: A pointer to a memory location where pointers are stored(Still, can't be casted to IntPtr) /// Integer that points how many arguments there are in argv - public unsafe static void RVExtensionArgs(char* output, int outputSize, char* function, char** argv, int argc) + public static unsafe void RVExtensionArgs(char* output, int outputSize, char* function, char** argv, int argc) { //Let's grab the string from the pointer passed from the Arma call to our extension //Note the explicit cast @@ -94,7 +103,7 @@ we have to convert it to a byte array in order to allow the arma extension loade /// A pointer to the memory location of a chars array that will be read after the load of the extension. /// An integer that determines the maximum lenght of the array - public unsafe static void RVExtensionVersion(char* output, int outputSize) + public static unsafe void RVExtensionVersion(char* output, int outputSize) { string greetingsString = "|Arma .NET Core Sample|"; diff --git a/cs/net core/dotnet_a3.csproj b/cs/net core/dotnet_a3.csproj index 40236d6..0108a88 100644 --- a/cs/net core/dotnet_a3.csproj +++ b/cs/net core/dotnet_a3.csproj @@ -1,10 +1,11 @@ dotnet_a3_x64 - netstandard2.0 + net5.0 true + Library - + diff --git a/cs/net core/nuget.config b/cs/net core/nuget.config index 02e3e99..5da2695 100644 --- a/cs/net core/nuget.config +++ b/cs/net core/nuget.config @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + \ No newline at end of file