mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: call module init
function if available
This commit is contained in:
parent
d0ac69d12e
commit
0050c1915b
@ -2132,6 +2132,14 @@ fn (g mut Gen) write_init_function() {
|
||||
g.writeln('\tbuiltin_init();')
|
||||
g.writeln('\tvinit_string_literals();')
|
||||
g.writeln(g.inits.str())
|
||||
for mod_name in g.table.imports {
|
||||
init_fn_name := '${mod_name}.init'
|
||||
if _ := g.table.find_fn(init_fn_name) {
|
||||
mod_c_name := mod_name.replace('.', '__')
|
||||
init_fn_c_name := '${mod_c_name}__init'
|
||||
g.writeln('\t${init_fn_c_name}();')
|
||||
}
|
||||
}
|
||||
g.writeln('}')
|
||||
if g.autofree {
|
||||
g.writeln('void _vcleanup() {')
|
||||
|
Loading…
Reference in New Issue
Block a user