which under Swift is of type:
Are you sure? The way that Swift imports pointers to C structs depends on how the struct is declared:
For a standard struct, you get
For an incomplete struct , you get
When I put your C declarations into a test project, the Swift declaration for
glfwGetMonitors comes back as:
func glfwGetMonitors(_ count: UnsafeMutablePointer<Int32>!) -> UnsafeMutablePointer<OpaquePointer?>!
The fact that you’re getting an error that includes
OpaquePointer suggests that this is happening to you as well.
GLFWmonitor an incomplete struct?
Share and Enjoy
Quinn “The Eskimo!” @ DTS @ Apple
 Incomplete structs are an oddity in C where you can declare a type like this:
This says “there is a struct
Foo but we don’t know anything about its contents yet”. This is commonly used for opaque ‘handles’ to objects. The C API is built in terms of pointers to such structs, allowing the implementer to keep all the details private.
For example, macOS has this declaration:
typedef const struct AuthorizationOpaqueRef * AuthorizationRef;
and then has a whole bunch of functions that operate on the resulting
OSStatus AuthorizationCreate(… AuthorizationRef * authorization);
OSStatus AuthorizationCopyRights(AuthorizationRef authorization …);
OSStatus AuthorizationFree(AuthorizationRef authorization …);
allowing apps to manipulate these authorisation references without knowing about any of the internal details.