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