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

Correct C interop declarations #315

Merged
merged 1 commit into from
Apr 19, 2022
Merged

Correct C interop declarations #315

merged 1 commit into from
Apr 19, 2022

Conversation

JVMerkle
Copy link
Contributor

Functions with external C linkage have to be wrapped with extern "C" { ... }, extern "C" as part of the function signature is not
sufficient.

Resolves #236

Signed-off-by: Julian Merkle [email protected]

Functions with external C linkage have to be wrapped with `extern
"C" { ... }`, `extern "C"` as part of the function signature is not
sufficient.

Resolves #236

Signed-off-by: Julian Merkle <[email protected]>
@JVMerkle JVMerkle requested a review from a team as a code owner March 17, 2022 19:34
@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @therealprof (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-resources labels Mar 17, 2022
Copy link
Member

@adamgreig adamgreig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! You're right, it's always extern "C" { pub fn foo(); } to declare a C function you want to call from Rust like this; it's only pub extern "C" fn foo(...) { ... } to define a function in Rust that you wish to be callable from C.

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 19, 2022

Build succeeded:

@bors bors bot merged commit 0d73660 into rust-embedded:master Apr 19, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 21, 2022
Update books

## book

3 commits in 765318b844569a642ceef7bf1adab9639cbf6af3..de0dbffc5812fd885700874e8d258dd334733ac4
2022-04-12 21:14:47 -0400 to 2022-04-18 19:29:45 -0400
- Remove duplicate text
- Add missing punctuation mark in ch16-01
- Update main.rs

## rust-by-example

1 commits in c2a98d9fc5d29c481d42052fbeccfde15ed03116..44a80e8d8bfc5881c9bd69a2cb3a570776ee4181
2022-04-08 06:44:18 -0300 to 2022-04-19 07:46:28 -0300
- Use rust 2018 module file hierarchy (rust-lang/rust-by-example#1532)

## rustc-dev-guide

6 commits in eeb5a83..043e60f
2022-04-11 23:29:48 +0900 to 2022-04-20 18:57:49 +0900
- Fix a small typo (rust-lang/rustc-dev-guide#1343)
- Extend debugging llvm section (rust-lang/rustc-dev-guide#1290)
- Send people doing *library* stabilizations over to the std-dev-guide (rust-lang/rustc-dev-guide#1317)
- Fix typo serious-&gt;series (rust-lang/rustc-dev-guide#1336)
- Minor type fix (rust-lang/rustc-dev-guide#1337)
- sessiondiagnostic: translation (rust-lang/rustc-dev-guide#1333)

## embedded-book

3 commits in a6de8b6e3ea5d4f0de8b7b9a7e5c1405dc2c2ddb..f7cefbb995eec8c6148f213235e9e2e03268e775
2022-03-17 21:21:39 +0000 to 2022-04-20 10:38:51 +0000
- Fix use of unaligned references in example  (rust-embedded/book#317)
- Correct C interop declarations  (rust-embedded/book#315)
- Update index.md  (rust-embedded/book#316)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-resources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Declaring extern "C" functions to be called from Rust
4 participants