igneous01 19 Posted July 6, 2013 I am very curious about what can and cannot be done with callExtension. I read the documentation on the wiki which describes what the signature of the dll will be and how to set it up, but what I dont know is, when would I use this over something in sqf? I see that the return type is limited to char *, but im assuming some form of casting/conversion might be possible. Is the purpose mainly for communicating with other processes? like ie. Ventrilo, database, network process ? Or is there something more that I can do with it? Im fairly competent in c++, so Im just curious about what limits are imposed when writing a .dll for RVExtension? Share this post Link to post Share on other sites
Simas 12 Posted July 6, 2013 You can use callExtension to provide extra functionality not available in SQF. Database access, other scripting languages, etc. Basically you pass in a string input and you return a string output. The input string can be your custom protocol. The output can be SQF, so it can be forwarded to call compile directly. The main limitation of callExtension interface are (from my head): - You can't call back to SQF within your C++ code. There is a trick however involving multiple threads, where when you need to call SQF code - you return from the main thread, do an SQF call and then immediately call back (recursively) to your extension with a result. I think someone on the forum had a proof of concept of this, but can't recall the name and thread right now. - The output buffer has a hard limit (10kb) and depending on the data you are passing around could affect your extension or not. There is also a trick with recursive callExtension calls as a workaround for this limitation. - Linux shared libraries (.so) and dedicated server is not supported. - Debugging callExtension DLL with ARMA 3 is not possible because of Steam DRM. But you can use non-steam version of Arma 2: OA for this. Share this post Link to post Share on other sites
Horner 13 Posted July 6, 2013 Basically you pass in a string input and you return a string output. This isn't totally true, you pass an array of strings into the function, if the function takes strings into it's parameters (works the same way as an ArmA function, only it's not loosely written so it must be defined in the function), so say in your plugin (I'm just going to use C# and standard ArmA2Net plugin structure) you have this... [AddIn("MyPlugin")] public string ReturnMyString(string myString) { return myString; } You would call it like so.... _return = "Arma2Net.Unmanaged" callExtension "MyPlugin [ReturnMyString, 'StringContent']"; And would return back to you "StringContent". Share this post Link to post Share on other sites
Simas 12 Posted July 7, 2013 (edited) @Horner: The exported DLL signature is: __declspec(dllexport) void __stdcall RVExtension(char* output, int outputSize, const char* input); UTF-8 string is passed in as input and UTF-8 string is returned as output. No arrays are involved. The code you are referring might be related to the ArmA2Net functionality. Edited July 7, 2013 by Simas Share this post Link to post Share on other sites
Horner 13 Posted July 7, 2013 I see what you mean, generally Arma2Net is used for most plugins, but yes the overall code that is passed into the extension is a string, I figured this was a given. _return = "Extension" callExtension "stringtobepassed"; Share this post Link to post Share on other sites