From 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:41:38 +0200 Subject: Adding upstream version 1.0.1. Signed-off-by: Daniel Baumann --- .../vala/24 export dynamic shared module/app.vala | 21 +++++++++++++++++++++ .../24 export dynamic shared module/meson.build | 20 ++++++++++++++++++++ .../24 export dynamic shared module/module.vala | 3 +++ 3 files changed, 44 insertions(+) create mode 100644 test cases/vala/24 export dynamic shared module/app.vala create mode 100644 test cases/vala/24 export dynamic shared module/meson.build create mode 100644 test cases/vala/24 export dynamic shared module/module.vala (limited to 'test cases/vala/24 export dynamic shared module') 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; +} -- cgit v1.2.3