Hi Simon,

 Is the use of an array here ... a way round converting things to pointers?


Yes, see:
http://docs.julialang.org/en/release-0.3/manual/calling-c-and-fortran-code/#passing-pointers-for-modifying-inputs

(you could do `retInfo = BeagleInstanceDetails(...)` and then pass
`&retInfo` in ccall, but then you would not see the modifications)

Also, is there any reason that resourceNumber::Int should be rather than
> resourceNumber::Cint?


Oversight on my part. When interfacing with C it is a good idea to use the
C* aliases because they will take care of some cross-platform peculiarities.

kills my IJulia kernel...are there any good ways to debug the external C
> calls?


The best way is to use a debugger, gdb or lldb (though admittedly a bit of
a learning curve). Try running your test under the basic Julia shell; that
should give you a backtrace at least. If you want to post your code
somewhere (e.g. gist.github.com) I could have a look.

Isaiah



On Sat, Apr 18, 2015 at 7:12 AM, Simon Frost <[email protected]> wrote:

> Dear Isaiah,
>
> Thanks, this has all really helped. Is the use of an array here:
>
> retInfo = [BeagleInstanceDetails(0,0,0,0,0)]
>
> a way round converting things to pointers? I had initial problems as I
> defined
>
> retInfo = BeagleInstanceDetails(0,0,0,0,0)
>
> and didn't know how to convert it.
>
> Also, is there any reason that resourceNumber::Int should be rather than
> resourceNumber::Cint?
>
> I've wrapped the complete example, but the last function call
>
> ccall((:beagleCalculateRootLogLikelihoods, "libhmsbeagle"),
>     Int,
> (Cint,Ptr{Cint},Ptr{Cint},Ptr{Cint},Ptr{Cint},Cint,Ptr{Cdouble}),
>
> instance,rootIndex,categoryWeightIndex,stateFrequencyIndex,cumulativeScaleIndex,1,logL)
>
> kills my IJulia kernel...are there any good ways to debug the external C
> calls?
>
> Best
> Simon
>

Reply via email to