I am wrapping a library that returns an opaque structure. The call that gives me my result looks like:
z = @ccall mylib.returns_opaque()::Ptr{Cvoid}
If the structure is properly initialized, it will be nonzero (i.e. not NULL). If it is likely that it is initialized, I’ll get something back like this:
Ptr{Nothing} @0x0000561f9dd53790
If it didn’t work, something like this:
Ptr{Nothing} @0x0000000000000000
How can I differentiate between the two? There don’t seem to be any fields for Ptr
?
julia> z
Ptr{Nothing} @0x0000000000000000
julia> z == 0
false
julia> fieldnames(typeof(z))
()