Use optional CFFI in the Lime tools

This commit is contained in:
Joshua Granick
2015-08-28 11:00:13 -07:00
parent 5ff7c5382d
commit 89fe74a08c
2 changed files with 41 additions and 24 deletions

View File

@@ -255,7 +255,11 @@ class System {
#end #end
#if optional_cffi #if optional_cffi
lazy = true; if (library != "lime" || method != "neko_init") {
lazy = true;
}
#end #end
if (disableCFFI) { if (disableCFFI) {
@@ -478,34 +482,46 @@ class System {
if (!__loadedNekoAPI) { if (!__loadedNekoAPI) {
var init = load ("lime", "neko_init", 5, lazy); try {
if (init != null) {
loaderTrace ("Found nekoapi @ " + __moduleNames.get ("lime")); var init = load ("lime", "neko_init", 5);
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) { 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; __loadedNekoAPI = true;
} }

View File

@@ -3,4 +3,5 @@
-D lime-curl -D lime-curl
-lib lime -lib lime
-lib format -lib format
#-lib svg #-lib svg
-D optional_cffi