Error calling Fortran from Julia

Thank you @sostock, with your suggestion I finally got some numbers out of fortran. Somehow I kept having problems reading integers. Everytime I wanted to print them I got trash. I had to change the way I was sending them in the Julia code and now is working

using Libdl
lib = Libdl.dlopen("libs/ipmf.so")
sym = Libdl.dlsym(lib, :wavg_f_)
x = Cdouble[1.0,2.0,3.0]
w = Cdouble[1.0,1.0,1.0]
n = 3
wavg = Ref{Cdouble}(50.0)
ccall(sym, Cvoid, (Ref{Cdouble}, Ref{Cdouble}, Cint, Ref{Cdouble}), x, w, n, wavg)

For reasons I don’t yet understand Ref{Cint} / Ref(c) wasn’t passed through properly and because I’m using that variable to define my arrays it make everything crash.

Thank you very much for your help