v2 / vlib / v / live / sharedlib / live_sharedlib.v
19 lines · 17 sloc · 980 bytes · f821c657a7dde8ba41a913a2c9e11968c6bfdbc7
Raw
1module sharedlib
2
3import v.live as _
4
5@[export: 'set_live_reload_pointer']
6@[markused]
7pub fn set_live_reload_pointer(p voidptr) {
8 // NOTE: the `g_live_reload_info` global on windows, in the DLL, has a different address itself,
9 // compared to the g_live_reload_info in the main executable.
10 //
11 // The code here, ensures that *its value* will be the same,
12 // since the executable, will make sure to load the DLL, and then call set_live_reload_pointer()
13 // after binding it, in its generaged `v_bind_live_symbols`, with the value of its own `g_live_reload_info` global.
14 //
15 // This is not necessary on macos and linux, but it is best to have the same code across systems anyway.
16 // eprintln('>>>>> before &g_live_reload_info: ${voidptr(&g_live_reload_info)} | g_live_reload_info: ${voidptr(g_live_reload_info)}')
17 g_live_reload_info = p
18 // eprintln('>>>>> after &g_live_reload_info: ${voidptr(&g_live_reload_info)} | g_live_reload_info: ${voidptr(g_live_reload_info)}')
19}
20