- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi All!
I'm new to the Fortran world and have inherited some legacy code that needs to be given a bit of updating.
Under the new scheme we need Fortran to access a Memory Mapped File (created by the VB side) and assign variables to memory locations.
I've done a bit of research into this area and know its possible! I was hoping someone out there might be able to point me towards a good sample of how to do this?
So my question is:
-Whats the best way to assign a variableto a memory locationin Fortran?
Thanks for any help.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting gfaiz@nodent.co.uk
-Whats the best way to assign a variableto a memory locationin Fortran?
A "Cray pointer" or C_PTR may come from another language, if there is compatibility with C, or may be created on the Fortran side by C_LOC for an object with TARGET attribute. By C_F_POINTER you can make a Fortran pointer consistent with the C_PTR.
gfortran, IBM, and ifort public documentation all have useful discussions. It might be "best" to use the features in a manner which is agreed upon by documentation for multiple compilers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Create a user defined type to describe the data layout you intend to use in your memory mapped file.
(you may need multiple user defined types)
Call a C function to map the file and return a pointer to the type.
Call C_F_POINTER to "convert" the C pointer to F pointer to point to your memory mapped file.
Note, it the memory mapped file is an array of REAL, then you do not need a user defined type.
Also, additional work will be required to construct an array descriptor if the shared data is an array of ...
Look in the IVF documentsection under interoperability issues.
Jim Dempsey
(you may need multiple user defined types)
Call a C function to map the file and return a pointer to the type.
Call C_F_POINTER to "convert" the C pointer to F pointer to point to your memory mapped file.
Note, it the memory mapped file is an array of REAL, then you do not need a user defined type.
Also, additional work will be required to construct an array descriptor if the shared data is an array of ...
Look in the IVF documentsection under interoperability issues.
Jim Dempsey
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