diff --git a/lime/system/System.hx b/lime/system/System.hx index 87802ca61..0f988c72b 100644 --- a/lime/system/System.hx +++ b/lime/system/System.hx @@ -255,7 +255,11 @@ class System { #end #if optional_cffi - lazy = true; + if (library != "lime" || method != "neko_init") { + + lazy = true; + + } #end if (disableCFFI) { @@ -478,34 +482,46 @@ class System { if (!__loadedNekoAPI) { - var init = load ("lime", "neko_init", 5, lazy); - - if (init != null) { + try { - loaderTrace ("Found nekoapi @ " + __moduleNames.get ("lime")); - init (function(s) return new String (s), function (len:Int) { var r = []; if (len > 0) r[len - 1] = null; return r; }, null, true, false); + var init = load ("lime", "neko_init", 5); - } else if (!lazy) { + if (init != null) { + + loaderTrace ("Found nekoapi @ " + __moduleNames.get ("lime")); + init (function(s) return new String (s), function (len:Int) { var r = []; if (len > 0) r[len - 1] = null; return r; }, null, true, false); + + } else if (!lazy) { + + throw ("Could not find NekoAPI interface."); + + } - throw ("Could not find NekoAPI interface."); + #if lime_hybrid + var init = load ("lime-legacy", "neko_init", 5); + + if (init != null) { + + loaderTrace ("Found nekoapi @ " + __moduleNames.get ("lime-legacy")); + init (function(s) return new String (s), function (len:Int) { var r = []; if (len > 0) r[len - 1] = null; return r; }, null, true, false); + + } else if (!lazy) { + + throw ("Could not find NekoAPI interface."); + + } + #end + + } catch (e:Dynamic) { + + if (!lazy) { + + throw ("Could not find NekoAPI interface."); + + } } - #if lime_hybrid - var init = load ("lime-legacy", "neko_init", 5); - - if (init != null) { - - loaderTrace ("Found nekoapi @ " + __moduleNames.get ("lime-legacy")); - init (function(s) return new String (s), function (len:Int) { var r = []; if (len > 0) r[len - 1] = null; return r; }, null, true, false); - - } else if (!lazy) { - - throw ("Could not find NekoAPI interface."); - - } - #end - __loadedNekoAPI = true; } diff --git a/tools/tools.hxml b/tools/tools.hxml index 582ddf732..3242cbe27 100644 --- a/tools/tools.hxml +++ b/tools/tools.hxml @@ -3,4 +3,5 @@ -D lime-curl -lib lime -lib format -#-lib svg \ No newline at end of file +#-lib svg +-D optional_cffi \ No newline at end of file