Reputation: 73
So i've tried to make my own PAWN sdk for D Programming Language, i know there are already PAWN sdk for D but i just want to try to make it by myself.
I got strange problem when i convert this C code to D:
struct tagAMX;
typedef cell (*AMX_NATIVE)(struct tagAMX *amx, cell *params);
typedef struct tagAMX_NATIVE_INFO {
const char *name;
AMX_NATIVE func;
} AMX_NATIVE_INFO;
And i've convert it to D code:
struct AMX;
alias AMX_NATIVE = cell function(AMX* amx, cell* params);
struct AMX_NATIVE_INFO {
immutable(char)* name;
AMX_NATIVE func;
}
Do i wrote it right?, if that code look fine, just ignore it.
The main problem is here: in C
AMX_NATIVE_INFO PluginNatives[] =
{
{"HelloWorld", HelloWorld},
{0, 0}
};
How do i write that on D? i tried with:
AMX_NATIVE_INFO[] NativeInfo =
[
["HelloWorld", HelloWorld],
[0, 0]
];
It just give me error:
function test.HelloWorld (AMX* amx, int* params) is not callable using argument types ()
cannot implicitly convert expression ([0, 0]) of type int[] to AMX_NATIVE_INFO
Upvotes: 2
Views: 116