Continuing on my attempt to learn Julia ccall by wrapping liboauth...I have 
the following code that was mostly generated by Clang.jl:


https://github.com/randyzwitch/OAuth.jl/blob/master/src/OAuth.jl#L248-254


function oauth_split_url_parameters(url::String,argv::Ptr{Ptr{Ptr{Uint8}}})
    result = 
ccall((:oauth_split_url_parameters,LIBOAUTH),Cint,(Ptr{Uint8},Ptr{Ptr{Ptr{Uint8}}}),url,argv)
    if result == C_NULL
        error("oauth_split_url_parameters failed")
    end
    return result
end

I'm pretty sure I want to re-write this code to remove the second argument, 
since the second argument is just allocating space for an array. I don't 
want to return the Cint for success/fail, but rather the array that splits 
the 'url' argument.

function oauth_split_url_parameters(url::String)
    argv = *Ptr{Ptr{Ptr{Uint8}}}* #What Julia code actually goes here to 
make this work?
    result = 
ccall((:oauth_split_url_parameters,LIBOAUTH),Cint,(Ptr{Uint8},Ptr{Ptr{Ptr{Uint8}}}),url,argv)
    if result == C_NULL
        error("oauth_split_url_parameters failed")
    end
    return argv
end

I've tried allocating an array() in place of Ptr{Ptr{Ptr{Uint8}}} , but 
that doesn't work. I think this is an array of pointers to string 
variables? How can I make this work?

Thanks.


Reply via email to