Also here is a simple example:
subroutine foo1(n,x,y)
integer*4, intent(in) :: n
integer*4, intent(in), dimension(n) :: x
integer*4, intent(out), dimension(n) :: y
y = 2*x
end subroutine foo1
subroutine foo2(n,x,y)
integer*8, intent(in) :: n
integer*8, intent(in), dimension(n) :: x
integer*8, intent(out), dimension(n) :: y
y = 2*x
end subroutine foo2
Compile into a shared library, and then in Julia, e.g.:
ftest = Libdl.dlopen("ftest.dll")
t = ones(Int32,2)
ccall(Libdl.dlsym(ftest,:foo1_), Void, (Ref{Int32}, Ref{Int32}, Ptr{Int32}), Int32(2), Int32.([3, -1]), t)
println(t)
t = ones(Int64,2)
ccall(Libdl.dlsym(ftest,:foo2_), Void, (Ref{Int64}, Ref{Int64}, Ptr{Int64}), 2, [3, -1], t)
println(t)
Libdl.dlclose(ftest)