There seems to be hardly any examples to be found about calling C from Julia (perhaps because people feel no need to do so). Moreover the docs are, at least to me, quite cryptic. So if anyone wants to get started here is a minimal example.
Julia Code:
type mystruct n::Int32 end
C Code:
struct mystruct{ int n; }; void structure(struct mystruct * input); void sructure(struct mystruct * input){ (*input).n=99; }
Compilation:
gcc -fPIC -shared rosetta.c -o rosetta.so
Execution:
julia> test=mystruct(10)
mystruct(10)
julia> ccall((:structure, "rosetta.so"), Void, (Ref{mystruct},), test);
julia> test
mystruct(99)