| 1 |
load("//examples/windows/dll:windows_dll_library.bzl", "windows_dll_library") |
| 2 |
|
| 3 |
filegroup( |
| 4 |
name = "srcs", |
| 5 |
srcs = glob(["**"]), |
| 6 |
visibility = ["//examples:__pkg__"], |
| 7 |
) |
| 8 |
|
| 9 |
# Define the shared library |
| 10 |
windows_dll_library( |
| 11 |
name = "hellolib", |
| 12 |
srcs = ["hello-library.cpp"], |
| 13 |
hdrs = ["hello-library.h"], |
| 14 |
# Define COMPILING_DLL to export symbols during compiling the DLL. |
| 15 |
# See hello-library.h |
| 16 |
copts = ["/DCOMPILING_DLL"], |
| 17 |
) |
| 18 |
|
| 19 |
# **Explicitly link to hellolib.dll** |
| 20 |
|
| 21 |
## Declare hellolib.dll as data dependency and load it explicitly in code. |
| 22 |
cc_binary( |
| 23 |
name = "hello_world-load-dll-at-runtime", |
| 24 |
srcs = ["hello_world-load-dll-at-runtime.cpp"], |
| 25 |
data = [":hellolib.dll"], |
| 26 |
) |
| 27 |
|
| 28 |
# **Implicitly link to hellolib.dll** |
| 29 |
|
| 30 |
## Link to hellolib.dll through its import library. |
| 31 |
cc_binary( |
| 32 |
name = "hello_world-link-to-dll-via-lib", |
| 33 |
srcs = ["hello_world-link-to-dll-via-lib.cpp"], |
| 34 |
deps = [":hellolib"], |
| 35 |
) |