diff --git a/compiler/main.v b/compiler/main.v index 4d42e408df..6b862e3157 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -390,7 +390,7 @@ int load_so(byteptr path) { cgen.genln('return 1; } void reload_so() { - int last = 0; + int last = os__file_last_mod_unix(tos2("$file")); while (1) { // TODO use inotify int now = os__file_last_mod_unix(tos2("$file")); @@ -536,6 +536,15 @@ fn (v mut V) cc() { else { a << '-g' } + if v.pref.is_live || v.pref.is_so { + // See 'man dlopen', and test running a GUI program compiled with -live + if (v.os == .linux || os.user_os() == 'linux'){ + a << '-rdynamic' + } + if (v.os == .mac || os.user_os() == 'mac'){ + a << '-flat_namespace' + } + } mut libs := ''// builtin.o os.o http.o etc if v.pref.build_mode == .build { a << '-c' diff --git a/examples/hot_code_reloading/bounce.v b/examples/hot_code_reloading/bounce.v index f4a0bd8c03..9659348baf 100644 --- a/examples/hot_code_reloading/bounce.v +++ b/examples/hot_code_reloading/bounce.v @@ -1,5 +1,5 @@ // Build this example with -// v -live -sanitize bounce.v +// v -live bounce.v module main import gx