mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: fix v -cc tcc -live run examples/hot_reload/graph.v
too
This commit is contained in:
parent
202f9574ec
commit
e9fac05775
@ -4839,6 +4839,18 @@ fn (mut g Gen) const_decl_precomputed(mod string, name string, field_name string
|
||||
}
|
||||
|
||||
fn (mut g Gen) const_decl_write_precomputed(mod string, styp string, cname string, field_name string, ct_value string) {
|
||||
if g.pref.is_livemain || g.pref.is_liveshared {
|
||||
// Note: tcc has problems reloading .so files with consts in them, when the consts are then used inside the reloaded
|
||||
// live functions. As a workaround, just use simple #define macros in this case.
|
||||
//
|
||||
// If you change it, please also test with `v -live run examples/hot_reload/graph.v` which uses `math.pi` .
|
||||
g.global_const_defs[util.no_dots(field_name)] = GlobalConstDef{
|
||||
mod: mod
|
||||
def: '#define $cname $ct_value // precomputed3, -live mode'
|
||||
order: -1
|
||||
}
|
||||
return
|
||||
}
|
||||
g.global_const_defs[util.no_dots(field_name)] = GlobalConstDef{
|
||||
mod: mod
|
||||
def: '$g.static_modifier const $styp $cname = $ct_value; // precomputed2'
|
||||
|
Loading…
Reference in New Issue
Block a user