[LIP] problem with using Fortran routine in C..

Pavan N Zope <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Organization Fluent India Pvt Ltd
Message-ID <[email protected]>
Hello
       I am facing a weired problem in calling a fortran routine from 
c.  The fortran function in question is like this:-

subroutine fortran_fun(idtab, nx, x, nf, nh, nhd,  info, rinfo, fa, ga, 
ha, stats,iusr_size, iusr,rusr_size, rusr )
    implicit none
    external usrfgh
    external foo
    integer :: idtab, nx, nf, nh, nhd, info(20),itno
    integer :: iusr_size, rusr_size
    integer :: iusr(iusr_size)
    doubleprecision :: x(nx), rinfo(20+nx+nf)
    doubleprecision :: fa(nf), ha(nhd), stats(50)
    doubleprecision :: ga(nf,nx)
    doubleprecision :: rusr(rusr_size)
    character*128 :: fn
...........
...........

      While calling this function from another c with  debugger 
attached, gdb  output is:-

fortran_fun (idtab=13, nx=2, x=(), nf=1, nh=0, nhd=1, info=(0, 0, 0, 1, 
0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0), rinfo=(), fa=(), ga=(), 
ha=(), stats=Cannot access memory at address 0x0
) at isat_wrap.f90:8

         the varible *stats* is a pointer of _double_(fortran real*8 = c 
double) type and points to 50 valid blocks of memory allocated in C. (i 
have checkd it in c side and it is not NULL). It seems that the satck 
gets corrupted while calling the fortran function. How can I proceed?  I 
am using gcc 3.2 and intel fortran compiler.
         Any help is welcome.

Thanks in advance
Pavan

-- 
------------------------------------------------------------------------

"Art is the lie that reveals the truth"
        -- Pablo Picasso




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.