diff options
Diffstat (limited to 'meson/test cases/unit/17 prebuilt shared')
5 files changed, 59 insertions, 0 deletions
diff --git a/meson/test cases/unit/17 prebuilt shared/alexandria.c b/meson/test cases/unit/17 prebuilt shared/alexandria.c new file mode 100644 index 000000000..2d6b84831 --- /dev/null +++ b/meson/test cases/unit/17 prebuilt shared/alexandria.c @@ -0,0 +1,6 @@ +#include"alexandria.h" +#include<stdio.h> + +void alexandria_visit() { + printf("You are surrounded by wisdom and knowledge. You feel enlightened.\n"); +} diff --git a/meson/test cases/unit/17 prebuilt shared/alexandria.h b/meson/test cases/unit/17 prebuilt shared/alexandria.h new file mode 100644 index 000000000..6e507c5ae --- /dev/null +++ b/meson/test cases/unit/17 prebuilt shared/alexandria.h @@ -0,0 +1,20 @@ +#pragma once + +/* Both funcs here for simplicity. */ + +#if defined _WIN32 || defined __CYGWIN__ +#if defined BUILDING_DLL + #define DLL_PUBLIC __declspec(dllexport) +#else + #define DLL_PUBLIC __declspec(dllimport) +#endif +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +void DLL_PUBLIC alexandria_visit(); diff --git a/meson/test cases/unit/17 prebuilt shared/another_visitor.c b/meson/test cases/unit/17 prebuilt shared/another_visitor.c new file mode 100644 index 000000000..18e5f150e --- /dev/null +++ b/meson/test cases/unit/17 prebuilt shared/another_visitor.c @@ -0,0 +1,10 @@ +#include<alexandria.h> +#include<stdio.h> + +int main(int argc, char **argv) { + printf("Ahh, another visitor. Stay a while.\n"); + printf("You enter the library.\n\n"); + alexandria_visit(); + printf("\nYou decided not to stay forever.\n"); + return 0; +} diff --git a/meson/test cases/unit/17 prebuilt shared/meson.build b/meson/test cases/unit/17 prebuilt shared/meson.build new file mode 100644 index 000000000..41c11c656 --- /dev/null +++ b/meson/test cases/unit/17 prebuilt shared/meson.build @@ -0,0 +1,14 @@ +project('prebuilt shared library', 'c') + +cc = meson.get_compiler('c') +shlib = cc.find_library('alexandria', dirs : meson.current_source_dir()) + +exe = executable('patron', 'patron.c', dependencies : shlib) +test('visitation', exe) + +d = declare_dependency(dependencies : shlib) + +exe2 = executable('another_visitor', 'another_visitor.c', + dependencies : d) +test('another', exe2) + diff --git a/meson/test cases/unit/17 prebuilt shared/patron.c b/meson/test cases/unit/17 prebuilt shared/patron.c new file mode 100644 index 000000000..461d7b487 --- /dev/null +++ b/meson/test cases/unit/17 prebuilt shared/patron.c @@ -0,0 +1,9 @@ +#include<alexandria.h> +#include<stdio.h> + +int main(int argc, char **argv) { + printf("You are standing outside the Great Library of Alexandria.\n"); + printf("You decide to go inside.\n\n"); + alexandria_visit(); + return 0; +} |