fix hot code reloading for GUI example bounce on linux: works when compiled with 'v -live -sanitize bounce.v' .

It crashes with SIGSEGV, when -sanitize is not given.
Also thirdparty/glad/glad.o should be build with -fPIC .
pull/1153/head
Delyan Angelov 2019-07-15 12:38:12 +03:00 committed by Alexander Medvednikov
parent 3b1964e9df
commit 60ad97c4fb
2 changed files with 3 additions and 3 deletions

View File

@ -241,7 +241,7 @@ fn build_thirdparty_obj_file(flag string) {
}
}
cc := if os.user_os() == 'windows' { 'gcc' } else { 'cc' } // TODO clang support on Windows
res := os.exec('$cc -c -o $obj_path $cfiles')
res := os.exec('$cc -fPIC -c -o $obj_path $cfiles')
println(res)
}

View File

@ -1,5 +1,5 @@
// Build this example with
// v -live bounce.v
// v -live -sanitize bounce.v
module main
import gx
@ -64,7 +64,7 @@ const (
W = 50
)
//[live] TODO segfaults
[live]
fn (ctx &Game) draw() {
ctx.vg.draw_rect(ctx.x, ctx.y, W, W, gx.rgb(0, 0, 255))
}