Bind(c) for procedures with complicated derived types
John McFarland
john.mcfarland@swri.org
Wed Jun 3 20:26:00 GMT 2009
Steve Kargl wrote:
> REMOVE:kargl[131] gfc43 -S -o - d.f90 | sed s/__fmod_MOD_/_Oh_My_/g | as -o d.o
> REMOVE:kargl[132] nm d.o
> 0000006e T _Oh_My_init_object
> 00000187 T _Oh_My_object_size
> 00000000 T _Oh_My_print_object
> U _gfortran_os_error
> U _gfortran_runtime_error
> U _gfortran_st_write
> U _gfortran_st_write_done
> U _gfortran_transfer_array
> U malloc
>
> Of couse, the use of fmod.mod still mangles the name to refers
> __fmod_MOD_init_object, etc if fmod is used in other Fortran code,
> so your *.o file is useless.
>
Interesting idea, but as you mention, we need the *.o files for other
Fortran code. We're also experimenting with using C MACROS in the C
header definitions, like
#ifdef __GFORTRAN__
#define MODFUNCNAME(mod,fname) __ ## mod ## _MOD_ ## fname
#else
#define MODFUNCNAME(mod,fname) mod ## _MP_ ## fname
#endif // if __GFORTRAN__
Then:
#define init_object MODFUNCNAME(fmod,init_object)
etc.
More information about the Fortran
mailing list