# Feature Proposal: Hiding Public Functions from C++

**URL:** <https://forums.swift.org/t/feature-proposal-hiding-public-functions-from-c/81301>\
**Category:** C++ interoperability\
**Tags:** swift-evolution, cxx-interop\
**Created:** [July 25, 2025, 3:39pm UTC](https://forums.swift.org/t/feature-proposal-hiding-public-functions-from-c/81301 "2025-07-25T15:39:08Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Xazax-hun](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/xazax-hun/32/36110_2.png) [@Xazax-hun](https://forums.swift.org/u/Xazax-hun)\
**Post date:** [July 29, 2025, 3:30pm UTC](https://forums.swift.org/t/feature-proposal-hiding-public-functions-from-c/81301/8 "2025-07-29T15:30:11Z")

</div>

Thanks for all the suggestions, we plan to discuss this later this week on the C++ Interoperability Workgroup meeting: [📅 C++ interoperability workgroup: upcoming meetings - #71 by egor.zhdan](https://forums.swift.org/t/c-interoperability-workgroup-upcoming-meetings/63016/71)

Feel free to join!

> [@ksluder](#):
>
> Swift exposes types to other languages, especially structs that are shared with C and C++

Good point. Do you know use cases where someone wants to expose a type to C but not to C++? I wonder if we do need this granularity. Also, do we have this problem with C? The reason why we have this problem with C++ because by default we expose all the public Swift declarations we can to C++. On the other hand, `@cdecl` is opt-in so I am not 100% sure if we need the equivalent functionality in C.

> [@ksluder](#):
>
> In the meantime, how about `@available(cxx, unavailable)`?

This is also an interesting suggestion, but this would be a way bigger change. We might need to go through Swift evolution. `@_expose` is underscored, so we can use it to test an implementation out without having to go through the full evolution process.

> [@Hacksaw](#):
>
> Could one then do `@_expose(Cxx, "")` to hide something?

I think this could work. The main concern here is the discoverability. But I think that could be mitigated via good documentation.

---

_[View the full topic](https://forums.swift.org/t/feature-proposal-hiding-public-functions-from-c/81301)._
