I have a C system header file in my project looking like:
struct SLObjectItf_;
typedef const struct SLObjectItf_ * const * SLObjectItf;
typedef void (SLAPIENTRY *slObjectCallback) (
SLObjectItf caller,
const void * pContext,
SLuint32 event,
SLresult result,
SLuint32 param,
void *pInterface
);
struct SLObjectItf_ {
SLresult (*Realize) (
SLObjectItf self,
SLboolean async
);
};
and this generates cimport.zig in a temp dir looking like:
pub const SLObjectItf = [*c]const [*c]const struct_SLObjectItf_;
pub const slObjectCallback = ?*const fn (SLObjectItf, ?*const anyopaque, SLuint32, SLresult, SLuint32, ?*anyopaque) callconv(.c) void;
pub const struct_SLObjectItf_ = extern struct {
Realize: ?*const fn (SLObjectItf, SLboolean) callconv(.c) SLresult = @import("std").mem.zeroes(?*const fn (SLObjectItf, SLboolean) callconv(.c) SLresult),
which leads to a compile error:
/Users/gegogi/Projects/ZigAndroidTemplate/.zig-cache/o/a5b25ca4bcb5cff9410caf68f212b2b5/cimport.zig:1025:5: error: dependency loop detected
pub const SLObjectItf = [*c]const [*c]const struct_SLObjectItf_;
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
struct_SLObjectItf_: /Users/gegogi/Projects/ZigAndroidTemplate/.zig-cache/o/a5b25ca4bcb5cff9410caf68f212b2b5/cimport.zig:1027:40
SLObjectItf: /Users/gegogi/Projects/ZigAndroidTemplate/.zig-cache/o/a5b25ca4bcb5cff9410caf68f212b2b5/cimport.zig:1025:45
17 reference(s) hidden; use '-freference-trace=19' to see all references
because of a known issue:
I read that instead of using SLObjectItf for the function declaration I can use *anyopaque to detour the problem.
But cimport.zip is a generated file and I don’t know what to do.