Thank you for all of your feedback, I understand this process better now. There's one thing that I'm still unsure of.
In the examples I've seen so far, the types that have other types inside them have to have all of the attributes of the nested types.
For example, type A in Alessandro's example has var1_b1::Ptr{Void}. Will that pointer contain a reference to an Julia object (object might be the wrong term) of type B when returned from the C API? If that's the case, why do all of the attributes of the nested types have to be re-listed inside the parent type? Shouldn't you have a reference to the nested structs from that pointer?'
Here's an example of the type of nested structs that I need to passinto the API:
struct git_refdb {
git_refcount rc;
git_repository *repo;
git_refdb_backend *backend;
};
typedef struct {
git_atomic refcount;
void *owner;
} git_refcount;
typedef struct {
#if defined(GIT_WIN32)
volatile long val;
#else
volatile int val;
#endif
} git_atomic;
Is there an easier way to create the nested types on the Julia side,
or does it have to be this way for reasons I don't understand?
In the manual under "Mapping C Types to Julia" it says that calls to
`convert` will automatically be inserted to convert each argument to
the specified type. This is the example that it has:
ccall( (:foo, "libfoo"), Void, (Int32, Float64),
convert(Int32, x), convert(Float64, y))
Is there some way for me to define a new conversion that will handle
the nested structs when they are passed to and from the API?
Quick recap:- Will a Ptr{Void} in a parent type get filled with a reference to an object of the nested type when passed to an API?
- Why are all of the attributes of the nested types re-listed inside the parent type, and is there a way to inline that process?
- Is there an easier way to create the nested types to pass to C in Julia?
- Will defining a new conversion for the nested structs make the API passing easier?
Thank you, I realize I have a lot of questions. The support here has been phenomenal so far; I really do appreciate it.