illegal text-relocation of function pointer using gfortran on OS X 10.8
Ryan S. Elliott
elliott@aem.umn.edu
Mon Jan 20 03:04:00 GMT 2014
Hello,
I'm getting the following error messages on my OS X 10.8 system with Xcode
5.0.2 and gfortran 4.8.2 installed via homebrew.
% gfortran -shared f03_iso_c.f03
ld: illegal text-relocation to '_compute' in /var/folders/w3/_r4gjs1d363176f99wgkpwl80000gn/T//cc8VFCuI.o from 'anon' in /var/folders/w3/_r4gjs1d363176f99wgkpwl80000gn/T//cc8VFCuI.o for architecture x86_64
collect2: error: ld returned 1 exit status
The contents of f03_iso_c.f03 are
module F03_ISO_C
use, intrinsic :: iso_c_binding
contains
integer(c_int) function compute() bind(c) result(compute)
use, intrinsic :: iso_c_binding
implicit none
compute = 1
return
end function compute
end module F03_ISO_C
integer function F03_ISO_C_init()
use F03_ISO_C
use, intrinsic :: iso_c_binding
implicit none
call USE_FUNC_PTR(c_funloc(compute))
F03_ISO_C_init = 1
return
end function F03_ISO_C_init
subroutine USE_FUNC_PTR(f1)
use, intrinsic :: iso_c_binding
implicit none
type(c_funptr) :: f1
print *, f1, "is the address"
end subroutine USE_FUNC_PTR
Any help resolving this error would be much appreciated.
Thanks,
Ryan Elliott
More information about the Fortran
mailing list