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

32 or 64 Bits?

reneeculver
Beginner
1,353 Views
Is there is way for Intel fortran to tell if it's running on 32 or 64bits ? The length of an intptr will tell you in the VS CRF but it don't know how to do it in fortran.

Renee
0 Kudos
1 Solution
JVanB
Valued Contributor II
1,342 Views
[bash]program iswow64
   use iso_c_binding
   use ifwin
   implicit none
   type(c_funptr) cfp
   procedure(IsWow64Process),pointer :: fp
   integer(4) result
   cfp = GetProcAddress(GetModuleHandle("kernel32"//achar(0)),"IsWow64Process"//achar(0))
   if(c_associated(cfp)) then
      call c_f_procpointer(cfp,fp)
      if(fp(GetCurrentProcess(),result) /= 0) then
         if(result /= 0) then
            write(*,'(a)') 'It''s a SysWOW64 Process'
         else
            write(*,'(a)') 'It''s a normal process'
         end if
      else
         write(*,'(a,i0)') 'Strange error ',GetLastError()
      end if
   else
      write(*,'(a)') 'It''s a 32-bit OS'
   end if
end program iswow64
[/bash]

View solution in original post

0 Kudos
23 Replies
Steven_L_Intel1
Employee
117 Views
Robert,

Actually, I tried that and found that while there was indeed a possible return value for running under WOW, I could not get it to return that value.
0 Kudos
Robert_van_Amerongen
New Contributor III
117 Views
Dear Steve,

I am a little confused now. Some years ago I madesoftware that used the GetSystemInfo function to get relevant system information. There I added the line:

INTEGER,PARAMETER :: PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 = 10

So I did this because I thought at that time that that was relevant. I cannot reconstruct now why I did that and where I found this information.

At present I cannot find any related information on the MSDN network. Search with google gave many hits but I do not see any link with the SYSTEM_INFO structure.Therefore, for the time being I cannot other that conclude that I made a mistake that time!

Thank you that you brought this to my attention.

Robert
0 Kudos
Steven_L_Intel1
Employee
117 Views
The SYSTEM_INFO structure is real - you can find it here - but that value, which is defined in WinNT.h, is not documented. I even included my own definition of it in the Platform sample that calls GetSystemInfo, but I guess it never gets returned.
0 Kudos
Reply