From e518cdbe7f548fe51630d4c171803b5b537a380c Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Wed, 16 Jun 2021 12:15:16 +0300 Subject: [PATCH] ci: fix msvc compilation of interface code --- vlib/v/gen/c/cgen.v | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vlib/v/gen/c/cgen.v b/vlib/v/gen/c/cgen.v index 64b41f593e..ac9f35ce17 100644 --- a/vlib/v/gen/c/cgen.v +++ b/vlib/v/gen/c/cgen.v @@ -6549,7 +6549,9 @@ fn (mut g Gen) interface_table() string { } else { // the field is embedded in another struct cast_struct.write_string('\t\t.$cname = ($field_styp*)((char*)x') - if st != ast.voidptr_type { + if st == ast.voidptr_type { + cast_struct.write_string('/*.... ast.voidptr_type */') + } else { for embed_type in st_sym.struct_info().embeds { embed_sym := g.table.get_type_symbol(embed_type) if _ := embed_sym.find_field(field.name) { @@ -6574,6 +6576,13 @@ static inline $interface_name I_${cctype}_to_Interface_${interface_name}($cctype if g.pref.build_mode != .build_module { methods_struct.writeln('\t{') } + if st == ast.voidptr_type { + for mname, _ in methodidx { + if g.pref.build_mode != .build_module { + methods_struct.writeln('\t\t._method_${c_name(mname)} = (void*) 0,') + } + } + } for _, method in st_sym.methods { if method.name !in methodidx { // a method that is not part of the interface should be just skipped