ID:133197
 
I would like additions to call() so that it can call most DLLs/.so's and pass arguments in the normal format, rather than passing argc/argv and only passing strings.

For example, instead of doing this:
struct MyStruct {int a; int b; char *c;}
extern "C" __declspec(dllexport) char *MyFunc(int n, char *v[])
{
    if(n != 3)
        return "Error, invalid arguments";
    char *arg1 = v[0];
    int arg2 = atoi(v[1]);
    MyStruct *arg3 = StringToMyStruct(v[2]);
    ...
}

call("mydll.dll","_MyFunc")(myString, num2text(myNum), MyStructToString(myStruct))


arguments would be passed like this:
struct MyStruct {int a; int b; char *c;}
extern "C" __declspec(dllexport) char *MyFunc(int n, char *arg1, int arg2, MyStruct *arg3)
{
    if(n != 3)
        return "Error, invalid arguments";
    ...
}

call("mydll.dll","_MyFunc")(myString, myNum, myStruct)


(The first argument N would still be necessary because otherwise the DLL doesn't know if some arguments are missing)

The main advantage of this would be the ability to call system DLLs/.so's without writing wrappers.
Unlikely to happen due to the annoying amount of work necessary to do such behavior, not to mention BYOND cannot guarantee that it is calling the library function properly. A standard signature for all BYOND-callable functions is better.