Name Date Size #Lines LOC

..--

objc/H25-Apr-2025-12787

BUILD.bazelH A D25-Apr-202511 KiB475421

README.rstH A D25-Apr-20252.3 KiB6848

add.cH A D25-Apr-2025526 2016

add.cppH A D25-Apr-2025536 2016

add.hH A D25-Apr-2025121 118

add.mH A D25-Apr-2025402 129

add.mmH A D25-Apr-2025408 129

adder.goH A D25-Apr-2025204 158

adder_test.goH A D25-Apr-2025406 2017

bar.ccH A D25-Apr-202588 106

bar.goH A D25-Apr-202566 95

cc_libs_common.goH A D25-Apr-2025763 3529

cc_libs_darwin_test.goH A D25-Apr-20252.5 KiB9774

cc_libs_linux_test.goH A D25-Apr-20252.4 KiB9474

cgo_link_dep.cH A D25-Apr-2025639 161

cgo_link_test.goH A D25-Apr-2025766 258

cgo_ref.goH A D25-Apr-2025693 213

direct_dep.goH A D25-Apr-2025153 107

dylib_client.goH A D25-Apr-202591 115

dylib_test.goH A D25-Apr-2025153 118

external_includes_test.goH A D25-Apr-20252.1 KiB8660

foo.cH A D25-Apr-202557 84

foo.goH A D25-Apr-202566 95

generate_imported_dylib.shH A D25-Apr-2025995 2717

imported.cH A D25-Apr-202525 21

native_dep.cH A D25-Apr-202582 64

native_dep.hH A D25-Apr-202535 21

provide_external_symbol.goH A D25-Apr-2025211 137

pure.goH A D25-Apr-202529 42

race_off.cH A D25-Apr-202539 41

race_off.goH A D25-Apr-202559 62

race_on.cH A D25-Apr-202538 41

race_on.goH A D25-Apr-202557 62

race_test.goH A D25-Apr-2025873 3213

split_import_a.goH A D25-Apr-202543 42

split_import_b.goH A D25-Apr-2025208 118

split_import_c.cH A D25-Apr-202533 31

split_import_c.hH A D25-Apr-202570 74

split_import_cgo.goH A D25-Apr-2025129 115

split_import_i_test.goH A D25-Apr-2025115 107

split_import_x_test.goH A D25-Apr-2025196 1410

tag_cgo.goH A D25-Apr-2025116 116

tag_cgo_err.goH A D25-Apr-202570 72

tag_pure.goH A D25-Apr-202581 105

tag_pure_err.cH A D25-Apr-202530 21

tag_pure_err.goH A D25-Apr-202569 72

tag_test.goH A D25-Apr-2025672 3935

transitive_dep.goH A D25-Apr-2025129 115

use_c_symbol_through_go.cH A D25-Apr-202587 64

use_external_symbol.goH A D25-Apr-2025121 115

use_transitive_symbol.goH A D25-Apr-2025190 159

README.rst

1.. _#2067: https://github.com/bazelbuild/rules_go/issues/2067
2.. _#2622: https://github.com/bazelbuild/rules_go/issues/2622
3
4Basic cgo functionality
5=======================
6
7opts_test
8---------
9
10Checks that different sets of options are passed to C and C++ sources in a
11``go_library`` with ``cgo = True``.
12
13(generated_)?(versioned_)?dylib_test
14------------------------------------
15
16Checks that Go binaries can link against dynamic C libraries. Some libraries
17(especially those provided with ``cc_import``) may only have dynamic versions,
18and we should be able to link against them and find them at run-time.
19
20The non ``generated_`` tests are manual. The ``generate_imported_dylib.sh``
21script must be run before running the tests themselves.
22
23The ``generated_`` variants check that Go binaries can link against dynamic C
24libraries that are generated by another rule, rather than being included in the
25source tree.
26
27The ``versioned_`` variants check that Go binaries can link against dynamic C
28libraries that are only available as a versioned shared library, like
29``libfoo.so.1``, as used on Linux.
30
31cc_libs_test
32------------
33
34Checks that Go binaries that include cgo code may or may not link against
35libstdc++, depending on how they're linked. This tests several binaries:
36
37* ``pure_bin`` - built in ``"pure"`` mode, should not depend on libstdc++.
38* ``c_srcs`` - has no C++ code in sources, should not depend on libstdc++.
39* ``cc_srcs`` - has some C++ code in sources, should depend on libstdc++.
40* ``cc_deps`` - depends on a ``cc_library``, should depend on libstdc++
41  because we don't know what's in it.
42
43race_test
44---------
45
46Checks that cgo code in a binary with ``race = "on"`` is compiled in race mode.
47Verifies #1592.
48
49tag_test
50--------
51
52Checks that sources with ``// +build cgo`` are built when cgo is enabled
53(whether or not ``cgo = True`` is set), and sources with ``// +build !cgo``
54are only built in pure mode.
55
56cdeps_link_test
57---------------
58
59Checks that libraries in ``cdeps`` are linked into the generated ``_cgo_.o``
60executable used to produce ``_cgo_imports.go``. Verifies `#2067`_.
61
62split_import_test
63-----------------
64
65Checks that when a package with ``cdeps`` is recompiled due to a split test,
66the input files from ``cdeps`` are included in the recompilation and are passed
67to the linker. Verifies `#2622`_.
68