caling f90 [message #55716] |
Tue, 04 September 2007 08:18 |
woopik
Messages: 18 Registered: September 2007
|
Junior Member |
|
|
hi
i try run fortran 90 function via call_external an C wrapper
but i have errors ONLY when i try tu use standard functions like open
or write(*,*)
S = CALL_EXTERNAL('biblio.so','dlhipo', ra,ile)
when i use open
[*****@****] [test] >/usr/local/rsi/idl/bin/bin.linux.x86_64/idlde:
symbol lookup error: ./biblio.so:
undefined symbol: for_open
when i use write
[*****@****] [test] >/usr/local/rsi/idl/bin/bin.linux.x86_64/idlde:
symbo
l lookup error: ./biblio.so: undefined symbol: for_write_seq_lis
when i make call_external to a function without open or write
all works !!!
when i make SPAWN a program with open / write
all works good !
there are examples
my function DLH.f90
SUBROUTINE DLH(Ra,counter)
! lf is defined in module types as integer, parameter ::
lf=kind(1.d0)
use types
implicit none
real(lf), intent(in) :: Ra
integer, intent(out) :: counter
write(*,*)
write(*,*) "-> Utilisation de l'application dlhip."
counter=2
END SUBROUTINE DLH
my wrapper xtemp.c
#include <stdio.h>
void dlhipo(int argc, void *argv[])
{
extern void dlh_(); /* FORTRAN routine */
int *n;
float *f;
f = (float *) argv[0]; /*Ra*/
n = (int *) argv[1]; /*counter*/
dlh_(f, n);
}
my compile options
gcc -c -fPIC -shared xtemp.c for C wrapper
ifort -check bounds -c -mp1 -O3 -fPIC DLH.f90
ld -shared xtemp.o DLH.o -o biblio.so
my program when i use SPAWN
spawn,['../test/a.out'],/NOSHELL
program example
use types
implicit none
real(lf):: Ra
integer :: counter
write(*,*)
write(*,*) "-> Utilisation de l'application dlh."
open(22,file='./local.txt')
close(22)
Ra=2
counter=2
end
someone know why i have theses errors ?
thx
|
|
|