array pointer change after calling FORTRAN subroutine in C++
Qianqian Fang
fangqq@gmail.com
Sun Oct 23 17:40:00 GMT 2011
On 10/23/2011 02:23 AM, Steve Kargl wrote:
> The name of the language is Fortran not FORTRAN.
>
> Note, this mailing list is for the discussion of
> gfortran development. It is not intended as a
> a mailing list for mixed language programming
> questions.
I apologize. I did not read carefully about the scope
of the mailing list. I will redirect my question to
comp.lang.fortran, as suggested by Paul.
> Does your library work when called from a Fortran program?
> Have you fully debugged your library?
yes, I did. It worked fine when linked in a Fortran program.
> You are not interfacing C and Fortran. You are interfacing C++
> and Fortran. Since your new to this endeavor, why do you call
> this a strange issue?
I wrote a linear matrix solver in F95, compiled/ran
successfully with gfortran. I was hoping to make an
interface for C/C++ so people can use the Fortran
library in a mix-language environment.
Currently, passing data (struct/array) from C/C++ to Fortran
is working fine, even without use iso_c_binding. However,
after calling a Fortran subroutine, the pointer address
changed. The problematic code is between line#158~165
in this unit:
http://sourceforge.net/p/blit/code/ci/862d2efb4fabe33325b7fa1b390dae451170d0cb/tree/trunk/blit_cpp/include/blit_solvers.h
the Fortran sub it is trying to call is at line#74~95 of
http://sourceforge.net/p/blit/code/ci/862d2efb4fabe33325b7fa1b390dae451170d0cb/tree/trunk/blit_f90/src/blqmr/blit_blqmr_sub.f90?force=True
Anyway, I will seek my answers in comp.lang.fortran.
thanks for your reply.
Qianqian
More information about the Fortran
mailing list