# C interoperability, combinations of library and OS versions

**URL:** <https://forums.swift.org/t/c-interoperability-combinations-of-library-and-os-versions/14029>\
**Category:** Using Swift\
**Tags:** availability, c\
**Created:** [June 27, 2018, 11:58am UTC](https://forums.swift.org/t/c-interoperability-combinations-of-library-and-os-versions/14029 "2018-06-27T11:58:42Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![jrose](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jrose/32/408_2.png) [@jrose](https://forums.swift.org/u/jrose)\
**Post date:** [June 27, 2018, 6:07pm UTC](https://forums.swift.org/t/c-interoperability-combinations-of-library-and-os-versions/14029/4 "2018-06-27T18:07:22Z")

</div>

Meanwhile, another silly workaround you may not have thought of: function pointers:

```swift
#if CUSTOM_SQLITE_BUILD
func f1() {
  f1Impl(sqlite_foo) // the custom one
}
#else
@available(…)
func f1() {
  f1Impl(sqlite_foo) // the Apple one
}
#endif

private func f1Impl(_ sqlite_foo: @convention(c) (UnsafePointer<CChar>) -> Void) {
  sqlite_foo(🐵)
}

```

This has its own set of drawbacks, of course, but it can sometimes cut down on code duplication, and the extra function should get optimized away.

---

_[View the full topic](https://forums.swift.org/t/c-interoperability-combinations-of-library-and-os-versions/14029)._
