Skip to content #

Constants #

const (
	is_used = 1

fn info #

fn info() &LiveReloadInfo

LiveReloadInfo.live_linkfn should be called by the reloader to dlsym all live functions. TODO: research a way to implement live_linkfn in pure V, without complicating live code generation too much.

The callbacks: cb_compile_fail, cb_before, cb_after will be executed outside the mutex protected section, so be careful, if you modify your data inside them. They can race with your [live] functions.

cb_locked_before and cb_locked_after will be executed inside the mutex protected section. They can NOT race with your [live] functions. They should be very quick in what they do though, otherwise your live functions can be delayed. - give user access to program's LiveReloadInfo struct, so that the user can set callbacks, read meta information, etc.

type FNLinkLiveSymbols #

type FNLinkLiveSymbols = fn (linkcb voidptr)

type FNLiveReloadCB #

type FNLiveReloadCB = fn (info &LiveReloadInfo)

struct LiveReloadInfo #

struct LiveReloadInfo {
	vexe             string
	vopts            string
	original         string
	live_fn_mutex    voidptr
	live_linkfn      FNLinkLiveSymbols
	so_extension     string
	so_name_template string
pub mut:
	live_lib          voidptr
	reloads           int
	reloads_ok        int
	reload_time_ms    int
	last_mod_ts       i64
	recheck_period_ms int = 100
	cb_recheck        FNLiveReloadCB = voidptr(0)
	cb_compile_failed FNLiveReloadCB = voidptr(0)
	cb_before         FNLiveReloadCB = voidptr(0)
	cb_after          FNLiveReloadCB = voidptr(0)
	cb_locked_before  FNLiveReloadCB = voidptr(0)
	cb_locked_after   FNLiveReloadCB = voidptr(0)
	user_ptr          voidptr        = voidptr(0)