Isn't the answer to

But I still does not know how to expose host functions to the VM, It
would be fun to know how to do that. Probably I have already crossed
the solution, but forgot to convert between haXe and neko kinds and
therefore missed it.

in the sample?   I've kept that part and little else in the excerpt below.

J. Merrill



From:
Frank Eriksson <[email protected]>
To:
Robin Palotai <[email protected]>
Cc:
Neko intermediate language mailing list <[email protected]>
Date:
01/19/2011 07:02 AM
Subject:
Re: [Neko] Revealing host C functions to embedded NekoVM
Sent by:
<[email protected]>



Hello Robin and nekolist,
Thankyou Robin for your reply, It made me realize that I'd missed 
something:
[snip]
> DEFINE_PRIM(some_fun, 2);
> -----------------------
>
> Then compile it to "some.ndll" (link in the necessary dependencies),
> and get the method from Haxe using:
>
> -----------------------
>  var _somefun: Dynamic;
>
>   var ldr = neko.vm.Loader.local();
>   var epath =  neko.FileSystem.fullPath(
>            neko.io.Path.directory(neko.Sys.executablePath() ));
>   ldr.addPath(epath + "/");
>   _somefun = ldr.loadPrimitive("some@some_fun", 2);
>
>
>   public function some_fun(a: String, b: String): String {
>      return neko.Lib.nekoToHaxe(_somefun(
>               neko.Lib.haxeToNeko(a),
>               neko.Lib.haxeToNeko(b) ));
>   }
> --------------------

-- 
Neko : One VM to run them all
(http://nekovm.org)

Reply via email to