We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Originally posted by maleadt June 18, 2024 I'm trying to wrap some macOS C header, which has the following:
#ifdef __APPLE__ #import <dispatch/dispatch.h> #endif // __APPLE__
That header apparently has issues with Clang.jl, leading to:
[ Info: Building the DAG... ┌ Warning: [CollectDependentSystemNode]: found symbols in the system headers: [:dispatch_data_t] └ @ Clang.Generators ~/.julia/packages/Clang/uJQ2L/src/generator/passes.jl:95 ERROR: LoadError: There is no definition for dispatch_data_t's underlying type: [``] at /Users/tim/.julia/artifacts/fbb170fa64a06b66dd9a16aaa21bf12848042d9a/aarch64-apple-darwin20/sys-root/usr/include/dispatch/data.h:44:1 Stacktrace: [1] error(s::String) @ Base ./error.jl:35 [2] resolve_dependency!(dag::ExprDAG, node::ExprNode{Clang.Generators.TypedefElaborated, CLTypedefDecl}, options::Dict{String, Any}) @ Clang.Generators ~/.julia/packages/Clang/uJQ2L/src/generator/resolve_deps.jl:99 [3] (::ResolveDependency)(dag::ExprDAG, options::Dict{String, Any}) @ Clang.Generators ~/.julia/packages/Clang/uJQ2L/src/generator/passes.jl:286 [4] build!(ctx::Context, stage::Clang.Generators.BuildStage) @ Clang.Generators ~/.julia/packages/Clang/uJQ2L/src/generator/context.jl:176 [5] wrap(name::String, headers::String; defines::Vector{Any}, include_dirs::Vector{Any}, dependents::Bool) @ Main ~/Julia/pkg/Metal/res/wrap/wrap.jl:27 [6] wrap @ ~/Julia/pkg/Metal/res/wrap/wrap.jl:13 [inlined] [7] main() @ Main ~/Julia/pkg/Metal/res/wrap/wrap.jl:59 [8] top-level scope @ ~/Julia/pkg/Metal/res/wrap/wrap.jl:64 in expression starting at /Users/tim/Julia/pkg/Metal/res/wrap/wrap.jl:64
data.h:44:
data.h:44
DISPATCH_DATA_DECL(dispatch_data);
With the relevant macros for that:
#define DISPATCH_GLOBAL_OBJECT(type, object) ((OS_OBJECT_BRIDGE type)&(object)) #define DISPATCH_RETURNS_RETAINED OS_OBJECT_RETURNS_RETAINED #elif defined(__cplusplus) && !defined(__DISPATCH_BUILDING_DISPATCH__) /* * Dispatch objects are NOT C++ objects. Nevertheless, we can at least keep C++ * aware of type compatibility. */ typedef struct dispatch_object_s { private: dispatch_object_s(); ~dispatch_object_s(); dispatch_object_s(const dispatch_object_s &); void operator=(const dispatch_object_s &); } *dispatch_object_t; #define DISPATCH_DECL(name) \ typedef struct name##_s : public dispatch_object_s {} *name##_t #define DISPATCH_DECL_SUBCLASS(name, base) \ typedef struct name##_s : public base##_s {} *name##_t #define DISPATCH_GLOBAL_OBJECT(type, object) (static_cast<type>(&(object))) #define DISPATCH_RETURNS_RETAINED #else /* Plain C */ typedef union { struct _os_object_s *_os_obj; struct dispatch_object_s *_do; struct dispatch_queue_s *_dq; struct dispatch_queue_attr_s *_dqa; struct dispatch_group_s *_dg; struct dispatch_source_s *_ds; struct dispatch_channel_s *_dch; struct dispatch_mach_s *_dm; struct dispatch_mach_msg_s *_dmsg; struct dispatch_semaphore_s *_dsema; struct dispatch_data_s *_ddata; struct dispatch_io_s *_dchannel; } dispatch_object_t DISPATCH_TRANSPARENT_UNION; #define DISPATCH_DECL(name) typedef struct name##_s *name##_t #define DISPATCH_DECL_SUBCLASS(name, base) typedef base##_t name##_t #define DISPATCH_GLOBAL_OBJECT(type, object) ((type)&(object)) #define DISPATCH_RETURNS_RETAINED #endif #if OS_OBJECT_SWIFT3 && OS_OBJECT_USE_OBJC #define DISPATCH_SOURCE_TYPE_DECL(name) \ DISPATCH_EXPORT struct dispatch_source_type_s \ _dispatch_source_type_##name; \ OS_OBJECT_DECL_PROTOCOL(dispatch_source_##name, <OS_dispatch_source>); \ OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL( \ dispatch_source, dispatch_source_##name) #define DISPATCH_SOURCE_DECL(name) \ DISPATCH_DECL(name); \ OS_OBJECT_DECL_PROTOCOL(name, <NSObject>); \ OS_OBJECT_CLASS_IMPLEMENTS_PROTOCOL(name, name) #ifndef DISPATCH_DATA_DECL #define DISPATCH_DATA_DECL(name) OS_OBJECT_DECL_SWIFT(name) #endif // DISPATCH_DATA_DECL #else #define DISPATCH_SOURCE_DECL(name) \ DISPATCH_DECL(name); #define DISPATCH_DATA_DECL(name) DISPATCH_DECL(name) #define DISPATCH_SOURCE_TYPE_DECL(name) \ DISPATCH_EXPORT const struct dispatch_source_type_s \ _dispatch_source_type_##name #endif
Is this a known issue, or should I try to reduce the source code involved?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Discussed in #497
Originally posted by maleadt June 18, 2024
I'm trying to wrap some macOS C header, which has the following:
That header apparently has issues with Clang.jl, leading to:
data.h:44
:With the relevant macros for that:
Is this a known issue, or should I try to reduce the source code involved?
The text was updated successfully, but these errors were encountered: