Eugene Chernyshov a écrit : > Hi. > > I mentioned that you don't have any reference counting functions in Neko > Inteface API. How it works? Don't I need to Incref/Decref pointer after > doing operations?
No you don't, Neko is using a Garbage Collector. It means your values needs to be on the C stack, on the VM stack, or stored into some block of memory allocated with alloc_root in order to be reachable by the GC, and then not reused later to write some other data. >> Now if you --really-- want to access globals you can watch how the Neko >> toplevel is doing (see neko/src/neko/Console.nml source) although that's >> a bit tricky since global names are not kept at runtime. Maybe extending >> the http://nekovm.org/doc/view/module api would help here. >> > I need to expose "eval" and "execute" function for Neko to Python. I > see in Console.nml that you using a lot of Neko sources. I think that > this is very simple for you to write such functions in C > > value eval(const char *expression, |value *exception); > |void execute(const char *expression, |value *exception); > > |Please, help me with that. THis is not very simple. The Neko compiler is not written in C, it's written in NekoML which is an highlevel language that can compiles to Neko. If you want to get these methods, you'll have to build a .n containing a part of the compiler, then load it from your C library and call its method. See neko/src/neko/Console.nml which does just that (read,eval,print loop). Nicolas -- Neko : One VM to run them all (http://nekovm.org)
