diff options
Diffstat (limited to 'meson/test cases/fortran/14 fortran links c')
4 files changed, 35 insertions, 0 deletions
diff --git a/meson/test cases/fortran/14 fortran links c/clib.c b/meson/test cases/fortran/14 fortran links c/clib.c new file mode 100644 index 000000000..81b2e0c17 --- /dev/null +++ b/meson/test cases/fortran/14 fortran links c/clib.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +void hello(void){ + + printf("hello from C\n"); + +} diff --git a/meson/test cases/fortran/14 fortran links c/clib.def b/meson/test cases/fortran/14 fortran links c/clib.def new file mode 100644 index 000000000..4caeb24a9 --- /dev/null +++ b/meson/test cases/fortran/14 fortran links c/clib.def @@ -0,0 +1,2 @@ +EXPORTS + hello diff --git a/meson/test cases/fortran/14 fortran links c/f_call_c.f90 b/meson/test cases/fortran/14 fortran links c/f_call_c.f90 new file mode 100644 index 000000000..b3f70a7ca --- /dev/null +++ b/meson/test cases/fortran/14 fortran links c/f_call_c.f90 @@ -0,0 +1,11 @@ +program main +implicit none + +interface +subroutine hello() bind (c) +end subroutine hello +end interface + +call hello() + +end program diff --git a/meson/test cases/fortran/14 fortran links c/meson.build b/meson/test cases/fortran/14 fortran links c/meson.build new file mode 100644 index 000000000..a45f06fd3 --- /dev/null +++ b/meson/test cases/fortran/14 fortran links c/meson.build @@ -0,0 +1,15 @@ +project('Fortran calling C', 'fortran', 'c', + meson_version: '>= 0.51.0', + default_options : ['default_library=static']) + +ccid = meson.get_compiler('c').get_id() +if ccid == 'msvc' or ccid == 'clang-cl' + error('MESON_SKIP_TEST: MSVC and GCC do not interoperate like this.') +endif + +c_lib = library('clib', 'clib.c', vs_module_defs : 'clib.def') + +f_call_c = executable('f_call_c', 'f_call_c.f90', + link_with: c_lib, + link_language: 'fortran') +test('Fortran calling C', f_call_c) |