You can model your C-struct type with a Julia type. Each field of the Julia
type should have a type annotation (Cint, etc) and be in the same order as
the C-struct.

Here's an example of Julia code wrapping a C library:
https://github.com/JuliaLang/HttpParser.jl/blob/master/src/HttpParser.jl

I think this is the C code it's wrapping:
https://github.com/joyent/http-parser/blob/master/http_parser.c

-- Leah


On Tue, Jul 1, 2014 at 1:16 AM, <[email protected]> wrote:

> I am newer to julia. I have build shared library of C language. I want to
> call some c funtions in Julia ,but I have some problems with the params
> type and return type.
>
> For example:
> the C funtion  1:
> MyType computer(int a, int b, ..){
> ....//some operator
> MyType result;
> return result;
> }
>
> The C function 2:
> void computer2(MyType c){
>   ...//some operator
> }
>
> In the funciton 2, I have to pass  the result of the function 1 to
> function 2. In julia, I can use "ccall( (:computer, pathToLib),returnType,
> ( Int32, Int32), a, b);
> but the "returnType" should be "MyType" in C, but how to define in Julia?,
> and how to pass the "ccall(...)" result to function 2?
>
>

Reply via email to