Skip to content

Commit c4ef660

Browse files
committed
fix: use __declspec(dllimport) only for shared library
1 parent b6a03fc commit c4ef660

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tests/packages/link-library-in-subproject/subprojects/bar/meson.build

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
project('bar', 'c', version: '1.2.3')
66

7-
if meson.get_compiler('c').get_id() in ['msvc', 'clang-cl', 'intel-cl']
7+
if get_option('default_library') == 'shared' and meson.get_compiler('c').get_id() in ['msvc', 'clang-cl', 'intel-cl']
88
export_dll_args = ['-DBAR_DLL_EXPORTS']
99
import_dll_args = ['-DBAR_DLL_IMPORTS']
1010
else
@@ -15,7 +15,7 @@ endif
1515
example_lib = library(
1616
'examplelib',
1717
'examplelib.c',
18-
c_args: export_dll_args,
18+
c_shared_args: export_dll_args,
1919
install: true,
2020
)
2121

@@ -25,11 +25,10 @@ example_lib = library(
2525
unwanted_lib = library(
2626
'unwantedlib',
2727
'examplelib.c',
28-
c_args: export_dll_args,
28+
c_shared_args: export_dll_args,
2929
install: true,
3030
)
3131

32-
3332
bar_dep = declare_dependency(
3433
compile_args: import_dll_args,
3534
link_with: example_lib,

0 commit comments

Comments
 (0)