diff options
Diffstat (limited to 'test cases/vala/24 export dynamic shared module')
3 files changed, 44 insertions, 0 deletions
diff --git a/test cases/vala/24 export dynamic shared module/app.vala b/test cases/vala/24 export dynamic shared module/app.vala new file mode 100644 index 0000000..e016ecd --- /dev/null +++ b/test cases/vala/24 export dynamic shared module/app.vala @@ -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; +} diff --git a/test cases/vala/24 export dynamic shared module/meson.build b/test cases/vala/24 export dynamic shared module/meson.build new file mode 100644 index 0000000..9aa9fd9 --- /dev/null +++ b/test cases/vala/24 export dynamic shared module/meson.build @@ -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, +) diff --git a/test cases/vala/24 export dynamic shared module/module.vala b/test cases/vala/24 export dynamic shared module/module.vala new file mode 100644 index 0000000..5553727 --- /dev/null +++ b/test cases/vala/24 export dynamic shared module/module.vala @@ -0,0 +1,3 @@ +public int module_func () { + return app_func() + 1; +} |