From 932f6d1bef97fd674d7d597745094284e782d1e7 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 9 Jul 2019 21:54:23 +0300 Subject: [PATCH] Fix hot code reloading on linux --- compiler/main.v | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/main.v b/compiler/main.v index 277ce9e304..04e59b203f 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -386,9 +386,11 @@ string _STR_TMP(const char *fmt, ...) { #include void* live_lib; int load_so(byteptr path) { - //printf("load_so %s\\n", path); + char cpath[1024]; + sprintf(cpath,"./%s", path); + //printf("load_so %s\\n", cpath); if (live_lib) dlclose(live_lib); - live_lib = dlopen(path, RTLD_LAZY); + live_lib = dlopen(cpath, RTLD_LAZY); if (!live_lib) {puts("open failed"); exit(1); return 0;} ') for so_fn in cgen.so_fns { @@ -534,7 +536,7 @@ fn (v mut V) cc() { flags := v.table.flags.join(' ') //mut shared := '' if v.pref.is_so { - a << '-shared -fPIC'// -Wl,-z,defs' + a << '-shared -fPIC '// -Wl,-z,defs' v.out_name = v.out_name + '.so' } if v.pref.is_prod {