In this part I’m going to show how to make a simple extension in C# using VS2013. While you can make a library .dll in C# it is slightly different from C++ .dll, and I don’t think you can use it in the same way. However, the good news is that you can make C++ .dll but write your code in C# inside of it. Bear with me, because I don’t really know C# but I know how to Google :).

Ok, first thing is first. Follow this guide and create a C++ .dll project, call it test_cs. Follow the guide up to the point when you have to paste code in it. Instead of pasting the code provided, post this code:

// compile with: /clr #include <msclr\marshal.h> using namespace System; using namespace msclr::interop; extern "C" { __declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function); } void __stdcall RVExtension(char *output, int outputSize, const char *function) { //c# marshal_context^ context = gcnew marshal_context(); // prepare the exchange String^ ext_in = marshal_as<String^>(function); // read input String^ ext_out = ext_in; //copy input to output //c++ strncpy_s(output, outputSize, context->marshal_as<const char*>(gcnew String(ext_out)), _TRUNCATE); delete context; // clean after yourself }

It contains both C++ and C# languages. You should now also have multiple IntelliSense complains as VS2013 is not recognising C#. Go to Project -> Properties -> General and change Common Language Runtime Support to (/clr):

clr

Apply this and it should do the trick. Now go back to this guide to check on how to complete the .dll creation. Place test_cs.dll in Arma 3 main folder and run this test:

hint ("test_cs" callExtension "imma rwitin in C#");

If everything went ok, you should see your input in the hint:

imma_cs

Enjoy,
KK

Part 4

EDIT: Another tutorial for those wanting to make .dll in C#