Need to generate a vapi and a header, and then use that in the shared module. Needed for GNOME games. Closes https://github.com/mesonbuild/meson/issues/35380.46
parent
987c1cd70a
commit
d1e8ae19e6
5 changed files with 48 additions and 2 deletions
@ -0,0 +1,21 @@ |
||||
const string MODULE_LIB = "libapp_module.so"; |
||||
|
||||
delegate int ModuleFunc (); |
||||
|
||||
public int app_func () { |
||||
return 41; |
||||
} |
||||
|
||||
int main () { |
||||
Module module; |
||||
void *func; |
||||
unowned ModuleFunc mfunc; |
||||
|
||||
module = Module.open (MODULE_LIB, ModuleFlags.BIND_LAZY); |
||||
module.symbol ("module_func", out func); |
||||
mfunc = (ModuleFunc) func; |
||||
|
||||
print ("%d\n", mfunc ()); |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,20 @@ |
||||
project ('test', ['c', 'vala'], version: '0.1') |
||||
|
||||
deps = [ |
||||
dependency ('glib-2.0'), |
||||
dependency ('gmodule-2.0'), |
||||
] |
||||
|
||||
app = executable ( |
||||
'app', |
||||
['app.vala'], |
||||
dependencies: deps, |
||||
export_dynamic: true |
||||
) |
||||
|
||||
shared_module ( |
||||
'app_module', |
||||
['module.vala'], |
||||
link_with: app, |
||||
dependencies : deps, |
||||
) |
@ -0,0 +1,3 @@ |
||||
public int module_func () { |
||||
return app_func() + 1; |
||||
} |
Loading…
Reference in new issue