Le mercredi 09 mars 2016 à 09:38 -0800, Jeffrey Sarnoff a écrit :
> I am trying to wrap this so it will (a) print to STDOUT (b) (if
> possible) print to a string:
> void arf_fprint(FILE * file, const arf_t x)¶
> Prints x as an integer mantissa and exponent to the stream file.
> 
> arf_t is made with  arf(x), that works.
> 
> this:
> function arf_fprint(x::arb)
>            a = arf(x); s=STDOUT
>            ccall((:arf_fprint, :libarb), Void, (Ptr{s}, Ptr{arf_struct},), 
> &s, &a)
>        end
> does this:
> ERROR: TypeError: Ptr: in parameter, expected Type{T}, got Base.TTY
>  in arf_fprint at none:3
Ptr{s} is clearly wrong here. Try with Ptr{Void}. Also, the & syntax is
pre-0.4, I think you can do without it now. See the manual for more
details.

BTW, arf_struct is an unusual name for a Julia type: you'd better use
CamelCase as everywhere else. (And if it's not a type it won't work.)


Regards

Reply via email to