Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add c++ linking example #318

Merged
merged 2 commits into from Oct 7, 2017

Conversation

Projects
None yet
3 participants
@thibaultbarbie
Copy link
Contributor

thibaultbarbie commented Oct 5, 2017

I added an example for the compilation and linking of a bundled C++ library (#296).

@j-haj
Copy link
Contributor

j-haj left a comment

Overall I think this looks really good! Great work! I only have one nitpick on wording..


[![cc-badge]][cc] [![cat-development-tools-badge]][cat-development-tools]

Linking a bundled C++ library is almost the same as linking it with a C library. The main difference is the [`cpp`][cc-build-cpp] option that should be put to `true` and the addition of `extern "C"` in the foo.cpp file.

This comment has been minimized.

@j-haj

j-haj Oct 6, 2017

Contributor

Just a few nitpicks here. I think there is room to improve the clarity of these sentences.

Linking a bundled C++ library is almost the same as linking it with a C library.

I would reword this. I understand what you are saying here, but the use of "it" here technically refers to the bundled C++ library, although it seems you are using it to refer to the compiled binary. Something along the lines of "Linking a bundled C++ library is very similar to linking a bundled C library."

The main difference is the [cpp][cc-build-cpp] option that should be put to true and the addition of extern "C" in the foo.cpp file.

I would reword this as well. cpp(true) is a method used as part of the Builder pattern, not technically an option. I would reword to something along these lines:

"The two core differences when compiling and statically linking a bundled C++ library are specifying a C++ compiler via the builder method cpp(true) and preventing name mangling by the C++ compiler by adding the extern "C" section at the top of our C++ source file.

This comment has been minimized.

@thibaultbarbie

thibaultbarbie Oct 7, 2017

Author Contributor

Thanks for your suggestion! I agree it is a far better explanation now.

@budziq budziq merged commit b844035 into rust-lang-nursery:master Oct 7, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@budziq

This comment has been minimized.

Copy link
Collaborator

budziq commented Oct 7, 2017

Nicely done @thibaultbarbie !

Thanks for the great help @j-haj !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.