pf->Configure(pf,1024*1024,1);//memory quantity of 1mb. Maximum progs loadable into the instance of 1
//If you support multiple progs types, you should tell the VM the offsets here, via RegisterFieldVar
pn=pf->LoadProgs(pf,"testprogs.dat",0,builtins,sizeof(builtins)/sizeof(builtins[0]));//load the progs, don't care about the crc, and use those builtins.
if(pn<0)
printf("Failed to load progs\n");
else
{
//allocate qc-acessable strings here for 64bit cpus. (allocate via AddString, tempstringbase is a holding area not used by the actual vm)
//you can call functions before InitEnts if you want. it's not really advised for anything except naming additional progs. This sample only allows one max.
pf->InitEnts(pf,10);//Now we know how many fields required, we can say how many maximum ents we want to allow. 10 in this case. This can be huge without too many problems.
//now it's safe to ED_Alloc.
func=pf->FindFunction(pf,"main",PR_ANY);//find the function 'main' in the first progs that has it.
if(!func)
printf("Couldn't find function\n");
else
pf->ExecuteProgram(pf,func);//call the function
}
CloseProgs(pf);
}
//Run a compiler and nothing else.
//Note that this could be done with an autocompile of PR_COMPILEALWAYS.