Michael Pliskin a écrit :
> Hello list,
>
> I am playing with Neko modules now and I am slightly confused how to
> work with them. I've built a sample module from standard WebServer
> (in neko\src folder from CVS):
> nekoml tools\WebServer.nml
> nekoc -link webserver.n tools\WebServer
>
> This gives me a webserver.n module which I assume would give me a
> way to run a local WebServer by doing smth like
> var module = $loader.loadmodule("webserver", $loader);
> module.init();
> (as docs on nekovm.org say).
>
> Now I am trying the following haxe code:
> var loader = new neko.vm.Loader(untyped __dollar__loader);
> var server = loader.loadModule("webserver");
>
> now trace(server.getExports()) gives me smth like
> { __module: #abstract }
>
> and then globalsCount gives me 1141 - lots of stuff! And if I try
> to pull values using getGlobal(), I am getting lots of stuff... So
> any easy way to pull a function from a module by name?
If I remember correctly, Neko linker does not fill the exports table, so
you cannot get functions from a linked module.
If instead you directly load "tools/WebServer.n" then it will lazily
load all its dependencies and you might be able to get some methods from it.
Also, you can use neko.vm.Loader.local() to get current Loader from haXe.
Best,
Nicolas
--
Neko : One VM to run them all
(http://nekovm.org)