issue calling external fortran subroutines that have the 'bind' statement (fortran 2003 related)
I am experimenting a little bit with interfacing octave with Fortran
(90/95/2003) code. In general, this works really well, but there are
some things where I have some strange results (could be entirely due
to my lack of c-programming skills).
- octave 2.9.16 on fedora 7 x86_64 (had to compile this myself using a
modified rpm spec file, as fedora 7 only ships with 2.9.9)
- octave is compiled with standard compilers (gcc, gfortran)
- my external shared library is compiled using the intel fortran compiler 10.
- interface files are oct c++ files that are linked to that shared library
In general, I have not encountered any problems mixing fortran
compilers in this way.
1) fortran subroutines that have the BIND attribute (to define the
name when accessing it from c) only work if the name attribute of BIND
ends with an underscore.
-> subroutine times_two ( x , y ) bind(c, name="f90_mod_mp_times_two")
does not work
-> subroutine times_two ( x , y ) bind(c,
name="f90_mod_mp_times_two_") does work
if in the oct-file, i use:
F77_FUNC (f90_mod_mp_div_two, F90_MOD_MP_DIV_TWO) ( double& x, double& y);
does the macro F77_FUNC
2) logicals/booleans returned from a fortran subroutine that are true,
have the value 255 inside the oct file. I have to divide them by 255
so that true booleans have the value 1. Is this normal behaviour?
The opposite way does work correctly, booleans that are input in a
fortran subroutine from c++ are recognized correctly. At the moment, I
cannot provide an example that compiles fine with gfortran, as I am
having trouble accessing module procedures with that compiler.
3) there seems to be something wrong with the isreal and isinteger
built-in functions (at least, both isreal and isinteger return 1 with
the following oct file, that returns an integer array):