How to get a pointer Ptr{T} that references a variable of type T

That’s interesting! However, the latest version of Clang still generates bad signature for me. Apparently, it does not recognize a typedef that is a pointer to a struct.

Consider this simple function:

typedef struct {
    double x;
} FOO, *FOOP;

FOOP test1(double a, double b, FOOP c);

It gets wrapped as

function test1(a::Cdouble, b::Cdouble, c::FOOP)
    ccall((:test1, test), FOOP, (Cdouble, Cdouble, FOOP), a, b, c)
end

But, it would be fine with Foo * instead:

typedef struct {
    double x;
} FOO, *FOOP;

FOO *test1(double a, double b, FOO *c);

turns into

function test1(a::Cdouble, b::Cdouble, c)
    ccall((:test1, test2), Ptr{FOO}, (Cdouble, Cdouble, Ptr{FOO}), a, b, c)
end