- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just ported a fortran project from Compaq Visual Fortran to Intel and need to know the proper calling convention for the (Kernel32) "OpenFileMapping" routine.
My call was like this:
hMapObject = OpenFileMapping (FILE_MAP_READ,.FALSE., MapID)
It would compilewith the Compaq Visual Fortran compiler, when I used the DFWIN module instead of the KERNEL32 module.
I have included the entire Function that won't compile at the end of this message. I'll appreciate any advice for how to properly make this call.
Tore Leraand
FUNCTION GetEntireReadMap(MapID, strCallingProg, hMapObject)
USE KERNEL32, only: OpenFileMapping, MapViewOfFile, FILE_MAP_READ
! Return as handle to Map View of entire FileMapping
! ..also return hMapObject which is the File Mapping Handle
INTEGER*4 GetEntireReadMap, MapView
INTEGER*4 hMapObject
CHARACTER*(*) MapID
CHARACTER*(*) strCallingProg
GetEntireReadMap=0 !Default return unsuccessful...
hMapObject = OpenFileMapping (FILE_MAP_READ,.FALSE., MapID)
if (hMapObject==0) then
write(*,*) strCallingProg // ': OpenFileMapping failed'
else !Try to create a map view...
MapView = MapViewOfFile (hMapObject, FILE_MAP_READ, 0, 0, 0)
if (MapView==0) then
write(*,*) strCallingProg // ': MapViewOfFile failed'
else
GetEntireReadMap=MapView
endif
endif
return
END FUNCTION
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Taking a quick look - replace ".FALSE." in the call with "FALSE". ".FALSE." is the Fortran LOGICAL type, which is not the same as the C BOOL type that WIn32 API routines want. CVF ignored some type mismatches with explicit interfaces, sometimes leading to unexpected results. Intel Visual Fortran honors the explicit interface.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
Thanks, ...I can now compile the routine.
I included a "use IFWINTY" statement, and made the call to the OpenFileMapping routine with FALSE as parameter, and it compiled.
Is there no equivalentconstant in Fortran that can be passed in tothe OpenFileMapping routine?
Tore
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Um, sure, it's FALSE, as defined in the Win32 API modules. There's also TRUE. Fortran does not have a direct equivalent to the C bool type. Use the constants as defined in the modules. Just add FALSE to your ONLY list, same as you would other constants you get from the module.

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