Hi, I'm trying to embed the Neko VM in a C# application, using DllImport, but I can't get it to work.
See the attached for the C# import class that starts to wrap the Neko API.
Then, in the application, I do:
using System;
namespace test {
static class Program {
static void Main()
{
unsafe
{
NekoVM.neko_global_init(null);
void * vm = NekoVM.neko_vm_alloc(null);
NekoVM.neko_vm_select(vm);
NekoVM.value loader = NekoVM.neko_default_loader(null, 0);
NekoVM.value[] args = new NekoVM.value[2];
args[0] = NekoVM.neko_alloc_string("test.n");
args[1] = loader;
NekoVM.value[] exc = null;
int idVal = NekoVM.neko_val_id("loadmodule");
// This call crashes:
NekoVM.value fieldVal = NekoVM.neko_val_field(loader,
idVal);
NekoVM.value ret = NekoVM.neko_val_callEx(loader, fieldVal,
args, 2, exc);
}
}
}
}
When I run it, I get a crash in neko.dll!otable_find line 305, called from
val_field line 395 in others.c. At that point, o is an object where o->t is
983044, and o->table is 0x10. id is -1050022062.
Any ideas?
Regards,
Asger Ottar Alstrup
NekoVM.cs
Description: application/file
-- Neko : One VM to run them all (http://nekovm.org)
