File tree Expand file tree Collapse file tree 3 files changed +52
-2
lines changed Expand file tree Collapse file tree 3 files changed +52
-2
lines changed Original file line number Diff line number Diff line change @@ -143,3 +143,5 @@ common --experimental_google_legacy_api
143143# common --repository_cache=f:/b/r
144144# startup --output_user_root=f:/b/u
145145try-import %workspace%/../top.bazelrc
146+
147+ common --experimental_cc_static_library
Original file line number Diff line number Diff line change 1+ # Plain C/C++ library declaration
2+ cc_library (
3+ name = "lib_plain" ,
4+ srcs = ["lib.cc" ],
5+ deps = ["@otel_sdk//:dll" ],
6+ )
7+
8+ # Make shared library from it (.dll/.so/.dylib)
9+ cc_shared_library (
10+ name = "lib_dll_or_so" ,
11+ deps = [":lib_plain" ],
12+ )
13+
14+ # Extract the .imp/.lo file.
15+ filegroup (
16+ name = "lib_imp_or_lo" ,
17+ srcs = [":lib_dll_or_so" ],
18+ output_group = "interface_library"
19+ )
20+
21+ # Re-import back using the .imp/.lo + .dll/.so/.dylib
22+ cc_import (
23+ name = "lib" ,
24+ interface_library = ":lib_imp_or_lo" ,
25+ shared_library = ":lib_dll_or_so" ,
26+ )
27+
128cc_test (
229 name = "try" ,
3- srcs = ["try.cc" , "lib.cc" ],
4- deps = ["@otel_sdk//:dll" ],
30+ srcs = ["try.cc" ],
31+ deps = [
32+ "@otel_sdk//:dll" ,
33+ ":lib" ,
34+ ],
535)
Original file line number Diff line number Diff line change @@ -62,3 +62,21 @@ INFO: Elapsed time: 11.789s, Critical Path: 9.35s
6262INFO: 5 processes: 1 internal, 4 local.
6363INFO: Build completed successfully, 5 total actions
6464```
65+
66+ # Added proper lib.dll (lib_dll_or_so.dll)
67+
68+ - Bin folder had this, note the ` lib_or_so.dll ` and ` try.exe `
69+
70+ ![ bin_folder] ( bin_folder.png )
71+
72+ - Here is what ` lib_dll_or_so.dll ` ended up importing from ` otel_sdk.dll `
73+
74+ ![ lib_dll_or_so] ( lib_dll_or_so.png )
75+
76+ - Here is what ` try.exe ` refernece from ` lib_dll_or_so.dll ` - e.g. ` foo `
77+
78+ ![ try_importing_lib] ( try_importing_lib.png )
79+
80+ - And what ` try.exe ` references from ` otel_sdk.dll `
81+
82+ ![ try_importing_otel_sdk] ( try_importing_otel_sdk.png )
You can’t perform that action at this time.
0 commit comments