Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmd/cgo: documentation missing for C++ #6393
I believe that what that CL implemented is support for compiling .cc files and linking them into the program. Cgo per se still does not know about C++, in that you cannot refer to C.cout or anything like that. The new support only helps if you have a plain C header file implemented by C++ code.
What CL 8248043 did was, in effect, support using .cc files in much the same way we support using .c files. As far as I can tell we currently don't document the handling of .c files at all. It's not clear to me where this should be documented. This isn't a part of the cgo tool as such. It's the go tool that picks up .c (and now .cc) files. There is an interaction between the go tool and the cgo tool that is not documented anywhere as far as I know; the go tool treats .c files differently if the package uses cgo. Here is what is new in 1.2: if a package uses cgo, then any .cc files will be compiled with the C++ compiler and included in the package. There is another change that is probably not worth documenting: when linking a binary, if any package uses cgo and has a .cc file, then the C++ compiler will be used as the external linker (external linking is documented as part of cgo internals).