HaxeFoundation / neko

The Neko Virtual Machine
https://nekovm.org
Other
553 stars 107 forks source link

Open .ndll files? #246

Open krigeta opened 2 years ago

krigeta commented 2 years ago

Hello, how can we open the .ndll files using this?

tobil4sk commented 2 years ago

Just to explain this for anyone else who finds this issue, .ndll files are dynamically linked libraries for the neko vm. To load a function from an ndll file when targetting neko via haxe you can use this function: https://api.haxe.org/neko/Lib.html#load

For example, to load the regexp_match function from regexp.ndll, which takes 4 function arguments, you would do:

static var regexp_match = neko.Lib.load("regexp", "regexp_match", 4);

If for some reason you want to load an ndll file via the neko language, then you can use the $loader.loadprim() function which is documented here: https://nekovm.org/doc/ffi/#a-small-sample