migueldeicaza / TermKit

Terminal Kit - Console UI toolkit for Swift applications
MIT License
463 stars 17 forks source link

Swift Package Manager doesn't see m_cchar_t #6

Closed dropbear32 closed 3 years ago

dropbear32 commented 5 years ago

I'm trying to use this toolkit in my Swift Package Manager project; however, I can't figure out a way to import Curses-Bridging-Header.h and therefore m_cchar_t remains undefined, which makes this line error:

typealias add_wch_def = @convention(c) (UnsafeMutablePointer<m_cchar_t>) -> CInt

with

(!) '(<<error type>>) -> CInt' (aka '(<<error type>>) -> Int32') is not representable in Objective-C, so it cannot be used with '@convention(c)'
(!) Use of undeclared type 'm_cchar_t'

Is there a way for me to somehow define m_cchar_t such that add_wch_def functions correctly?

migueldeicaza commented 4 years ago

I have not tested this with the Swift Package Manager, only with Xcode.

I suspect that for swift package manager, we need two targets, one for a C library, and one for the Swift one.

migueldeicaza commented 3 years ago

This works with SwiftPM now