Hi,
On Apr 18, 8:48 am, "James Van Buskirk" <not_va...@[EMAIL PROTECTED]
> wrote:
> Spoken like a true C programmer. Why write a C wrapper to invoke a
> Fortran procedure when Fortran can do so all by itself? Here is an
> example with cray pointers, could be updated to use procedure
> pointers if they ever come true:
[Code skipped]
Thanks for the replies. I decided to give a try to Cray pointers as a
tem****ary replacement for pointers to procedures, and I was about to
try out the code you provided, but given that apparently it gave a
segmentation fault when trying to compile it, I decided to go for
something simpler :-)
I read this about Cray pointers and gfortran
http://gcc.gnu.org/onlinedocs/gfortran/Cray-pointers.html#Cray-pointers
but I've never used this feature, neither external procedures, so be
gentle :-)
I got a minimal code to try the Cray pointers, as per the
do***entation above:
[angelv@[EMAIL PROTECTED]
temp]$ cat temp.f90
PROGRAM test
IMPLICIT NONE
EXTERNAL sp
POINTER (subptr,subpte)
EXTERNAL subpte
subptr =3D LOC(sp)
CALL subpte
END PROGRAM test
SUBROUTINE sp
PRINT*, "HI"
END SUBROUTINE sp
But compilation is unsuccessfull:
[angelv@[EMAIL PROTECTED]
temp]$ gfortran -fcray-pointer -o temp temp.f90
In file temp.f90:6
EXTERNAL subpte
1
Error: CRAY POINTEE attribute conflicts with EXTERNAL attribute at (1)
In file temp.f90:10
CALL subpte
1
Error: CRAY POINTEE attribute conflicts with SUBROUTINE attribute in
'subpte' at (1)
In file temp.f90:5
POINTER (subptr,subpte)
1
Error: Symbol 'subpte' at (1) has no IMPLICIT type
[angelv@[EMAIL PROTECTED]
temp]$ gfortran --version
GNU Fortran (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)
Any help appreciated. Thanks,
=C1ngel de Vicente


|