mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
hot reload: no -sanitize is needed anymore, -live is now enough on both Linux and MacOS X
* hot reload for GL programs: force the main executable (the shared library loader) to be build with -rdynamic flag, when -live is passed to v compiler. * hot reload: optimize away a redundant load_so/0 call at the start of the reload_so thread. * hot code reload for MacOSX requires -flat_namespace flag instead of -rdynamic (on linux).
This commit is contained in:
parent
7c6f59afa6
commit
37aff9b107
@ -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'
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Build this example with
|
||||
// v -live -sanitize bounce.v
|
||||
// v -live bounce.v
|
||||
module main
|
||||
|
||||
import gx
|
||||
|
Loading…
Reference in New Issue
Block a user