FORTRAN from C++- some tips required

Hi,

I will give you a short description regarding my University project and shall be grateful if you can provide me soem tips

1) I have got an existing FORTRAN Code
2) The existign FORTRAN Code creates some dialogs and consequently the data is retrived from these dialogs and the core numerical sub routines called and necessary calculations done.
3) So far so good.

Now,

4) We are replacing the existing FORTRAN Dialogs with C++ dialogs due to soem reasons (I'm not going into details and reasons for this)
5)I intend using the same FORTRAN Sub routines which carry out the calculations and call FORTRAN From C++ which I found is possible and have demonstarted some examples.
6) Can anyone provide me some tips and tell me how can I retrieve the C++ dialog data and give it to the FORTRAN code?
7) Currently I have commented the FORTRAN dialog craetion part in the subroutines and hard coded the necessary inputs from the C++ dialog.

Any tips will eb extremely useful.

Jerome
What C++ dialog libraries you will use?
I am not sure as I am not involved in C++ programming.

The code is like this:

Fortran

call CreatFortranDialog(a,b,c,...)

!!!WE get values of a,b,c

C++

call CreateC++Dialogs

//I getvalues of variables from C++ dialogs

Currently I have commented the CreateFortranDialog call in FORTRAN code and hard coded the values of a,b,c

I was thinking of calling a C++ routine where I have commented CreateFortranDialog andd getting the values of variables I need.

Any advise will be appreciated with gratefulness.
Any help will be gratefully appreciated.
A modal C++ dialog migth be run like this:
1
2
3
4
5
6
MyDialog foo;
if ( foo.exec() )
  {
    // the user saw the dialog and closed it "the good way"
    // here we can dig from the foo's members the values we want
  }

That obviously can be wrapped into function, just like the Fortran version probably was:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
void ShowCppDialog( int & a, int & b )
{
  MyDialog foo;
  if ( foo.exec() )
    {
      a = foo.getA();
      b = foo.getB();
    }
  else
    {
      // set sane defaults instead
      a = 0; b = 42;
    }
}

Which is used in C++ code:
1
2
3
4
5
6
extern "C" void fortranRoutine( int, int );
..
int aVal = 0;
int bVal = 0;
ShowCppDialog( aVal, bVal );
fortranRoutine( aVal, bVal );
Thanks a lot.
Few clarifications:

1) ShowCppDialog is a C++ routine, right?
2) fortranRoutine is a FORTRAN routine.right?

Thanks a lot again
Topic archived. No new replies allowed.