Jump to content
maca134

Arma DllExport - C# Extensions

Recommended Posts

After using RGiesecke's DllExport package for years for getting C# ARMA extensions working, I wanted to know exactly how it worked and in the process ended up writing a DllExport package specific for ARMA's exports.

You can download it here https://www.nuget.org/packages/Maca134.Arma.DllExport/ or Maca134.Arma.DllExport in Nuget. Also source is on Github https://github.com/maca134/Maca134.Arma.DllExport.

 

Here is the old way of doing it (64bit):

[DllExport("RVExtension", CallingConvention = System.Runtime.InteropServices.CallingConvention.Winapi)]
public static void RVExtension(StringBuilder output, int outputSize, [MarshalAs(UnmanagedType.LPStr)] string function)
{
	output.Append(function);
}

With the new package it simplifies the code into:

[ArmaDllExport]
public static string Invoke(string function, int outputSize)
{
	return function;
}

The package will also switch the export name depending on bit'ness of the DLL.

 

  • Like 2

Share this post


Link to post
Share on other sites

Thank you! Do you know if there is a way to update the dll without restart ArmA?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×