Jump to content
Sign in to follow this  
Llano

How does CallExension work?

Recommended Posts

Hi!

I'm trying to call functions in one of my .dll files i have created from a mission. From what i have read from the documentation, this is what i have done:

I created a .dll file in c#, called "CallCommand.dll". Inside, i wrote a very simple code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CallCommand
{
   public class Class1
   {
       public static string hello()
       {
           return "Hello";
       }

   }
}

I saved it in a folder called "@extension".

Then i create a mission with these lines in the "init.sqf":

_string = "CallCommand" callExtension "hello";
hint format["String: %1", _string];

Saved the mission, launched ArmA 3 with the "@extension" as a mod. Starting the mission... Nothing happens. All i get is a hintbox with "String: ".

So, i'm obviously doing something wrong, forgetting something etc. I new to this extension thing so you know :)

EDIT: oh man, titel is spelled wrong. Obviously i meant "CallExtension".

Edited by Llano

Share this post


Link to post
Share on other sites

Well it is all there

The dll is expected to contain an entry point of a form _RVExtension@12, with a following C signature:

void __stdcall RVExtension(char *output, int outputSize, const char *function);

Share this post


Link to post
Share on other sites
Well it is all there

Yeah i saw that. But how do i write that in c#?

Something like this?

public static void RVExtension(char *output, int outputSize, const char *function);

(Btw getting error on "const char *function". Also, do i have to use "__stdcall" in c#?)

I have problem to understand how that works. It says on that page:

RVExtension is the only function called by the game engine.

The engine calls this automatically?

Sory for my newbie questions :)

Too bad they have no C# example.

Share this post


Link to post
Share on other sites

Can't help you with C#. All I know I downloaded Visual Studio 2010 which makes it very easy as it already has all templates you only need to copy paste RVExtension bit and it is done.

Share this post


Link to post
Share on other sites

You might find this helpful, the example does exactly what you are trying to do D:

Looks like its using C as bridge between Arma and C#

Edited by aeroson

Share this post


Link to post
Share on other sites
You might find this helpful, the example does exactly what you are trying to do D:

Looks like its using C as bridge between Arma and C#

Thank you so much. I'll check that out!

---------- Post added at 14:13 ---------- Previous post was at 13:20 ----------

Can just say that it works now :)

Thank you so much or helping me!

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
Sign in to follow this  

×