diff --git a/scripts/engine.cm b/scripts/engine.cm index 3064cfee..b506278b 100644 --- a/scripts/engine.cm +++ b/scripts/engine.cm @@ -586,6 +586,7 @@ function turn(msg) log.console(`FIXME: need to get main from config, not just set to true`) log.console(`FIXME: actors need the truncated use function as well`) +log.console(`FIXME: remove global access (ie globalThis.use)`) actor_mod.register_actor(cell.id, turn, true, config.system.ar_timer) if (config.system.actor_memory) @@ -710,9 +711,8 @@ var prog = cell.args.program // Resolve the main program path var locator = shop.resolve_locator(cell.args.program, ACTOR_EXT, null) -if (!locator) { +if (!locator) throw new Error(`Main program ${cell.args.program} could not be found`) -} $_.clock(_ => { var val = locator.symbol.call(null, $_, cell.args.arg); diff --git a/scripts/shop.cm b/scripts/shop.cm index fc47bb55..a03d0065 100644 --- a/scripts/shop.cm +++ b/scripts/shop.cm @@ -499,7 +499,9 @@ script_forms['.cm'] = function(path, script, pkg) { } script_forms['.ce'] = function(path, script, pkg) { - return `(function start($_, arg) { var args = arg; ${script} ; })` + var pkg_arg = pkg ? `'${pkg}'` : 'null' + var relative_use_fn = `def use = function(path) { return globalThis.use(path, ${pkg_arg});}` + return `(function start($_, arg) { ${relative_use_fn}; var args = arg; ${script} ; })` } // Get flags from config @@ -1227,7 +1229,6 @@ Shop.build_package = function(package) log.console("Linking " + lib_name) var link_flags = '-fPIC -shared' - if (platform == 'macOS') link_flags += ' -undefined dynamic_lookup' var ldflags = get_flags(config, platform, 'LDFLAGS') if (ldflags != '') link_flags += ' ' + ldflags @@ -1238,7 +1239,7 @@ Shop.build_package = function(package) objs_str += '"$HERE/' + c_objects[i] + '" ' } - var link_cmd = 'HERE=$(pwd); cd ' + module_dir + ' && cc ' + link_flags + ' ' + objs_str + ' -lc -lc++ -o ' + temp_lib + var link_cmd = 'HERE=$(pwd); cd ' + module_dir + ' && cc ' + link_flags + ' ' + objs_str + ' -lcell -lc -lc++ -o ' + temp_lib var ret = os.system(link_cmd) if (ret != 0) { log.error("Linking failed")