tried calling a simple fortran function from julia but did not succeed:
this is the fortran code:

!fileName = simplemodule.f95
module simpleModule

contains
function foo(x)
  integer :: foo, x
  foo = x * 2
end function foo


end module simplemodule


which is then compiled with:

*gfortran simplemodule.f95 -o simplemodule.so -shared -fPIC*

and finally the julia call is:


ccall((:foo, "/fullPathTo/simpleMod.so"), Int32, (Int32,), 3)


which then leads to the following error:

ERROR: ccall: could not find function foo in library 
/fullPathTo/simpleMod.so
 in anonymous at no file



when compiling with:

gfortran -c simplemodule.f95 -o simplemodule.so -shared -fPIC

i get a different error:

*ERROR: error compiling anonymous: could not load module 
/fullPathTo/simplemodule.so: /fullPathTo/simplemodule.so:*
*only ET_DYN and ET_EXEC can be loaded*



Can anyone tell me what I am missing?
I do realize I would not need to call fortran to multiply a variable by 2, 
but its a starting point..


Thanks!
Andre

Reply via email to