Skip to content

Conversation

@bricknerb
Copy link
Contributor

@bricknerb bricknerb commented Oct 21, 2025

This proposal details the toolchain implementation for calling imported C++
functions from Carbon. It covers how C++ overload sets are handled, the process
of overload resolution leveraging Clang, and the generation of "thunks"
(intermediate functions) when necessary to bridge Application Binary Interface
(ABI) differences between Carbon and C++.

@bricknerb bricknerb added proposal A proposal proposal draft Proposal in draft, not ready for review labels Oct 21, 2025
@bricknerb bricknerb force-pushed the proposal-calling-c++-function branch from a67dc02 to 078bf5b Compare October 21, 2025 09:26
This proposal details the mechanism for calling imported C++ functions from Carbon code. It covers how C++ overload sets are handled, the process of overload resolution leveraging Clang, and the generation of "thunks" – intermediate functions – when necessary to bridge Application Binary Interface (ABI) differences between Carbon and C++.
@bricknerb bricknerb marked this pull request as ready for review October 24, 2025 08:54
@bricknerb bricknerb requested a review from a team as a code owner October 24, 2025 08:54
@bricknerb bricknerb requested review from KateGregory and removed request for a team October 24, 2025 08:54
@github-actions github-actions bot added proposal rfc Proposal with request-for-comment sent out and removed proposal draft Proposal in draft, not ready for review labels Oct 24, 2025
@bricknerb
Copy link
Contributor Author

FWIW, I've started documenting some of this in #6358.

@bricknerb bricknerb requested a review from zygoloid November 17, 2025 12:35
Copy link
Contributor

@zygoloid zygoloid left a comment

Choose a reason for hiding this comment

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

There seems to be some overlap between this and https://docs.google.com/document/d/1KUxumZtNe3mY3TsjW2s_ZADOlAaFlrtsLKHVILtqIaM/edit -- but actually not very much. (And Chandler or I should turn that document into a proposal...)

Also, this document reads to me like it's mostly describing a design for implementing C++ function calls in the toolchain in particular (thunks, ABI, type representation, etc. are concerns at that level, I think), so perhaps we could very slightly adjust the framing here to be about that. I think that would also remove the appearance of overlap between the two proposals.

bricknerb added a commit to bricknerb/carbon-lang that referenced this pull request Nov 26, 2025
@bricknerb bricknerb changed the title Calling C++ Functions C++ Interop: Toolchain Implementation for Function Calls Nov 27, 2025
@bricknerb
Copy link
Contributor Author

There seems to be some overlap between this and https://docs.google.com/document/d/1KUxumZtNe3mY3TsjW2s_ZADOlAaFlrtsLKHVILtqIaM/edit -- but actually not very much. (And Chandler or I should turn that document into a proposal...)

Also, this document reads to me like it's mostly describing a design for implementing C++ function calls in the toolchain in particular (thunks, ABI, type representation, etc. are concerns at that level, I think), so perhaps we could very slightly adjust the framing here to be about that. I think that would also remove the appearance of overlap between the two proposals.

Done.

@bricknerb bricknerb requested a review from zygoloid November 27, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

proposal rfc Proposal with request-for-comment sent out proposal A proposal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants