I'm trying to make a module out of a C library and header file. It has at least 
one empty struct:

struct lgs_context_t {};

and a function:

LGS_EXPORT struct lgs_context_t* lgs_init(const lgs_context_params_t* params);

Swift sees the function, I can call it and assign the result to a variable, but 
Xcode (as usual) fails to show me what it thinks the type is. So I can't 
declare a class member to hold the returned pointer.

I'm trying to declare the member like this:

    var ctx: lgs_context_t?             //  Use of undeclared type 
'lgs_context_t'

I finally tried calling it like this:

    let ctx: UnsafeMutablePointer = lgs_init(...)

and the resulting error message gave me OpaquePointer. But couldn't it just 
typealias lgs_context_t to OpaquePointer?

Is there any way to do this in the modulemap?

Thanks!

-- 
Rick Mann
rm...@latencyzero.com


_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to