- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a mixed-language program with AC++ 6.0 and F. Most of the program is fort ran (both f. and .f90) with a few modules that are I++. One of the I++ modules connects to a SOL server data base and gets a record set. This module could be called 200 times or more in one execution of the program. I need to be able to do one of 2 things:
1) Make the record set stay in memory the whole time the program is running so that I don't have to call the database repeatly and the c++ module can use the data everytime it's called without having to go back to the database.
2) Be able to store the data effectively in a common block so that the fortran can use the data. (i.e. store a linked list in a common block that was created in c++)
Any help would be appreciated
Thanks,
Bryan
1) Make the record set stay in memory the whole time the program is running so that I don't have to call the database repeatly and the c++ module can use the data everytime it's called without having to go back to the database.
2) Be able to store the data effectively in a common block so that the fortran can use the data. (i.e. store a linked list in a common block that was created in c++)
Any help would be appreciated
Thanks,
Bryan
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hy Bryan:
option 1): I don't know c++ enought, but may be you can declare an static variables to use them every time...
option 2): A good way to make a "common" block is to declare global variables in a Fortran module. If you want to keep them together, create a derived type joining all of them. Your problem may be is to pass a dinamic varible (pointer...) between fortran and c++. If the variables are dinamic, the best option is a derived type using the "sequence" function, because pointer descriptors are not the same in fortran and C, and "sequence" is the only way to keep the memory under control. (fortran uses more memory than C to identify a pointer).
Or also use functions "malloc" and "free" that are very similar with C.
option 1): I don't know c++ enought, but may be you can declare an static variables to use them every time...
option 2): A good way to make a "common" block is to declare global variables in a Fortran module. If you want to keep them together, create a derived type joining all of them. Your problem may be is to pass a dinamic varible (pointer...) between fortran and c++. If the variables are dinamic, the best option is a derived type using the "sequence" function, because pointer descriptors are not the same in fortran and C, and "sequence" is the only way to keep the memory under control. (fortran uses more memory than C to identify a pointer).
Or also use functions "malloc" and "free" that are very similar with C.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page