I'm trying to add internal calls to mono like follows:
void addCall(char *name, char *amx_name)
{
AMX_NATIVE native = sampgdk::FindNative(name);
void(*natcall)() = []()
{
//Can't access native here... :(
callNative(native);
};
mono_add_internal_call(name, (void *)natcall);
}
The internal call should call a method with some data(the pointer to the native, AMX_NATIVE). However, the value can't be accessed within the lambda code.
When you use variable capture ( [&]() { ... } ) the lambda code can't be cast to a void * which i need to call mono_add_internal_call.
Can someone think of a way around this issue?