# Creating a C-accessible shared library in Swift?

**URL:** <https://forums.swift.org/t/creating-a-c-accessible-shared-library-in-swift/45329>\
**Category:** Using Swift\
**Tags:** linux\
**Created:** [March 5, 2021, 12:53am UTC](https://forums.swift.org/t/creating-a-c-accessible-shared-library-in-swift/45329 "2021-03-05T00:53:12Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![lorddimwit](https://avatars.discourse-cdn.com/v4/letter/l/e19adc/32.png) [@lorddimwit](https://forums.swift.org/u/lorddimwit)\
**Post date:** [March 5, 2021, 2:54pm UTC](https://forums.swift.org/t/creating-a-c-accessible-shared-library-in-swift/45329/3 "2021-03-05T14:54:51Z")

</div>

Thanks for the feedback.

I've looked into \_cdecl, but it seems to suffer from two major problems: it's not standardized or even officially supported, and it doesn't allow passing of Swift objects back into C to be held there. For example, if I create a handle in Swift, I have to pass it to the caller, who holds on to it. It doesn't seem possible to pass any sort of reference back to C that way.

Perhaps I'm wrong, though. Thanks again.

---

_[View the full topic](https://forums.swift.org/t/creating-a-c-accessible-shared-library-in-swift/45329)._
