The following solved this problem:

[17:44] <wat_> it looks like the array is being passed directly, although 
an array of ascii strings can't be passed directly in my experience
[17:46] <wat_> I created a function which creates an array of Ptr{UInt8} 
from an array of strings
[17:46] <wat_> convert( ::Type{Ptr{Ptr{UInt8}}}, s::Array{ASCIIString,1} ) 
= map(pointer ,s) |> pointer

On Tuesday, February 17, 2015 at 5:52:44 PM UTC-5, Zenna Tavares wrote:
>
> int ppl_version(const char** p)
>
> On Tuesday, February 17, 2015 at 5:38:36 PM UTC-5, Stefan Karpinski wrote:
>>
>> What is the signature of the ppl_version C function?
>>
>> On Tue, Feb 17, 2015 at 5:23 PM, Zenna Tavares <[email protected]> 
>> wrote:
>>
>>> I am attempting to wrap the Parma Polyhedron Primitive Library.
>>>
>>> It has a function 'ppl_version' which modifies a set of strings, 
>>> represented as a char **.  An example function which calls 'ppl_version' is 
>>> as follows: 
>>>
>>> get_ppl_version() {
>>>   const char* p;
>>>   (void) ppl_version(&p);
>>>   return p;
>>> }
>>>
>>>
>>> My Julia attempt is as follows:
>>>
>>> function get_ppl_version()
>>>   versionnum = Array{Uint8}[Array(UInt8, 20) for i = 1:4]
>>>   res = ccall((:ppl_version, "libppl_c"), Int, (Ptr{Ptr{Uint8}},), 
>>> versionnum)
>>>   bytestring(convert(Ptr{Uint8}, versionnum[1]))
>>> end
>>>
>>> However, I get gobbledygook back
>>>
>>> @show get_ppl_version() 
>>> =>$(Expr(:call, :ppl_version)) => "Xٮ\n"
>>>
>>> Actually the result is non-deterministic, evaluating it a few times 
>>> gives very strange results, e.g. ""set_bigfloat_roundin",  
>>> "isppl_initialzied", 
>>> ec. which seems to be random mix of my julia soure-code and c code from 
>>> the api itself.  I'm not sure how that is even possible.  What am I doing 
>>> wrong?
>>>
>>> Thanks
>>>
>>
>>

Reply via email to