* alignment/padding when mixing C struct and fortran 90 derived type
@ 2008-01-20 15:50 burlen
0 siblings, 0 replies; only message in thread
From: burlen @ 2008-01-20 15:50 UTC (permalink / raw)
To: gcc-help
Hi all,
currently I have some C code that will call a fortran 90 subroutine. In
the C portion I have defined:
struct record
{
int id;
int dataLen;
int *pFile;
double *data;
int ofs;
};
while in the fortran code I have defined:
module GGCM
type record
integer :: id
integer :: dataLen
integer, pointer :: pFile
real*8, pointer :: data
integer :: ofs
end type record
contains
end module
From a C code I will declare an instance of record, initialize it and
call a fortran subroutine which is defined like so
subroutine manipulateCStruct( kot )
use GGCM
implicit none
type(record) :: kot
kot%id = kot%ofs
kot%pFile = kot%ofs ! this should modify file which is in main.cpp
kot%ofs = 128
end subroutine
These will be compiled and linked using gcc, and gfortran. All is fine,
and works as I'd like with out compiler optimization. My question is
will I be safe passing above struct when compiler optimizations are
enabled? I have the intuition that so far as the compile lines use the
identical optimization flags, then all will be OK. But I'd like to
confirm if possible gfortran and gcc use same alignment/padding
optimizations.
Thanks in advance
Burlen
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-01-18 16:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-20 15:50 alignment/padding when mixing C struct and fortran 90 derived type burlen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).