class neko.vm.LoaderAvailable in nekoLoaders can be used to dynamicly load Neko primitives stored in NDLL libraries.
Loaders can be used to dynamicly load other Neko modules (.n bytecode files). Modules are referenced by names. To lookup the corresponding bytecode file, the default loader first look in its cache, then eventually adds the .n extension to the name and lookup the bytecode in its path.
Loaders can be used for sandbox security. When a Module is loaded with a given Loader, this loader can manager the module security by filtering which primitives can be loaded by this module or by rewrapping them at loading-time with custom securized versions. Loaders are inherited in loaded submodules.
var l : LoaderHandleThe abstract handle. function new( l : LoaderHandle ) : Void function addPath( s : String ) : VoidAdds a directory to the search path. See getPath function backupCache( c : Dynamic ) : DynamicChange the cache value and returns the old value. This can be used to backup the loader cache and restore it later. function getCache() : StringMap<Module>The default loader contains a cache of already loaded modules. It's ensuring that the same module does not get loaded twice when circular references are occuring. The same module can eventually be loaded twice but with different names, for example with two relatives paths reprensenting the same file, since the cache is done on a by-name basic. function getPath() : Array<String>The default loader contains a search path in its path field. It's a linked list of Neko strings that is a parsed version of the NEKOPATH. This path is used to lookup for modules and libraries. function loadModule( modName : String, ?loader : Loader ) : ModuleLoads a Module with the given name. If loader is defined, this will be this Module loader, else this loader will be inherited. When loaded this way, the module is directly executed. function loadPrimitive( prim : String, nargs : Int ) : DynamicLoads a neko primitive. By default, the name is of the form library@method. The primitive might not be used directly in Haxe since some of the Neko values needs an object wrapper in Haxe. function setCache( name : String, m : Module ) : VoidSet a module in the loader cache. static function local() : LoaderReturns the local Loader. This is the loader that was used to load the module in which the code is defined. static function make( loadPrim : String -> Int -> Dynamic, loadModule : String -> Loader -> Module ) : LoaderCreates a loader using two methods. This loader will not have an accessible cache or path, although you can implement such mecanism in the methods body.
version #17588, modified 2013-02-24 23:59:05 by api
0 comment