Getting undefined types with system library module

You are bumping into Opaque Pointers in Swift, as seen recently also in Swift-Linux-Glibc: error: cannot find type 'DIR' in scope - #2 by lukasa. The short version is that gpiod_chip is an "opaque type": C knows it exists, but doesn't know its size or any of its fields. Pointers to this type in Swift manifest as OpaquePointer, not UnsafePointer. You'll need to use OpaquePointer to interact with the type.

2 Likes