Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Fortran and C++ structure Sharing

stockmangl
Beginner
411 Views
Visual Fortran Standard Edition v6.6.B
Visual C++ v6.0
Given the following snippets of code:
Is there any way to share/access in Fortran 90/95 the
below structure ?? I would like to have access and be
visible to the Fortran/C routines. I need to be able to
access and change the values on the Fortran side, and have
them available and visible on the C side, and vice-versa.
Can you provide an example of what the common block/include/
module/structure on the Fortran should look like to share
and access the EngOrder C++ structure

type.h
struct EngOrder
{
unsigned int Type: 1;
unsigned int LClass : 4;
unsigned int LInstance : 8;
unsigned int EID : 10;
unsigned int TrackNum : 8;
unsigned int : 1;// spares
unsigned int TOL_Window : 7;
unsigned int : 25;// spares
unsigned int TOL;
};
extern "C" double c_advancetime(double requestedtime, double grantedtime)
{
/*****************************************************
For testing only!!!
*****************************************************/
if(((int)abc3->getCurrentTime() % 40) == 0)
{
EngaOrder eo;
CTC ctc;
eo.TrackNum = 1;
printf(" changing eo eo.TrackNum to %d ",eo.TrackNum);
eo.TrackNum = 56;
abc3->getEOQueue()->push_back(eo);
abc->getCTCQueue()->push_back(ctc);
}
.
.
.
return grantedtime;
}

Fortran

.
.
.
EXTERNAL c_advancetime
!DEC$ ATTRIBUTES C::c_advancetime
me_time = c_advancetime(me_time + timestep, me_grantedtime)
.
.
.
Thansks,
gstockman
0 Kudos
0 Replies
Reply