I happened to make a note of a post some time ago about getting fortran and
julia working together. Searching for that again returned this link:

http://julia-programming-language.2336112.n4.nabble.com/example-for-ccall-use-and-fortran-td7737.html

Hth, Adrian.


On Sat, Jan 16, 2016 at 3:32 PM, Chris <[email protected]> wrote:

> The Fortran code I'm working with assigns results to a number of global
> variables. One of those results is a 3x1 real array - let's call it v1.
>
> I'm trying to understand how to access this. Here's what I have:
>
> v1 = cglobal((:__libkl_mod_MOD_v1,"libkl.so"),Ptr{Float64})
>
> This gives me a Ptr{Ptr{Float64}}. I'm not sure what to do from here --
> using pointer_to_array just gives
>
> julia> pointer_to_array(v1,3)
> 3-element Array{Ptr{Float64},1}:
>  Ptr{Float64} @0x0000000000000000
>  Ptr{Float64} @0x0000000000000000
>  Ptr{Float64} @0x0000000000000000
>
> And then doing an unsafe_load on any of those elements gives me a
> segfault.
>
> Am I taking the right approach here? The Fortran code is not my own, so
> it's possible this is due to an error in that code, but I'm trying to rule
> out Julia interface issues first.
>
> Thanks in advance,
> Chris
>

Reply via email to