- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Renee
- Balises:
- Intel® Fortran Compiler
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
[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]
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
LOGICAL, PARAMETER :: I_AM_64_BIT = (INT_PTR_KIND() == 8)
If you want to ask if the program is running on a 64-bit OS, no matter how the program was built,. that's a bit harder but still doable.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Yes, I do want to tell two things:
1.) Whether the image was built for 32 or 64 bits.
and
2.) What the system is currently running on. Obviously 64 bit software cannot run on a 32 bit system.
Renee
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I have to ask, though - what are you going to do with this information?
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
[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]
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Renee
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I'm working an taking a historical program called Adventure and Ifwin has conflicting names init. It gives about six errors with IFWIN.
Renee
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
ISWOW64PROCESS is a undefined interface.
error #6303: The assignment operation or the binary expression operation is invalid for the data types of the two operands. [GETPROCADDRESS_G1]
error #6404: This name does not have a type, and must have an explicit type. [FP] C:\Users\renee\AppData\Local\Temporary Projects\Test\Test.f90 11
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
MSDN shows:
BOOL IsWow64Process( HANDLE hProcess, PBOOL Wow64Process );
-------
You transcribe to something like
------
INTERFACE
function IsWow64Process(hProcess, Wow64Process) use IFWINTY
INTEGER(BOOL) :: IsWow64Process
!DEC$ ATTRIBUTES DEFAULT, STDCALL, DECORATE, ALIAS:'IsWow64Process' :: IsWow64ProcessINTEGER(HANDLE) :: hProcess INTEGER(PBOOL) :: Wow64Process
end function IsWow64Process
end INTERFACE
------
Jim Dempsey
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
!DEC$ ATTRIBUTES REFERENCE :: Wow64Process
INTEGER(BOOL) :: Wow64Process
to describe that argument.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Steve,
They are for identification at the begining of the program. Primary they are for an idividual who attempts to run the 64 Bit program on a 32 bit system and wonders why it wont work. Of course...you would need a 64 bit system to run it For the ID.
Renee
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Thank you. I'll work on it.
Renee
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
There is no reason for you to build this as a 64-bit program. Just build it as 32-bit and it will run everywhere. I don't understand why you want to add so many levels of complexity to a simple console application.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I had a tenacious computer virus today. The way they are selling these diagnostic packages is disgraceful. The thing is just one step ahead of a virus and it makes quite a mess of the registry also. But I'm alright now and I have a very recent backup but I didn't need it.
Renee
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
First of all the book I got does not work for me. I use the index to find something and THAT book does not have the word datatype(s) in it???? How then, am I supposed to use such a book? Now if someone could recommend a technical book, I would appreciate it. I am working with a console task, so an emphasis on console tasks isnot out of the question or should I just go to AMAZON?
OK, this question....
I want to know whether my task was compiled and linked with 32 or 64 Bits.
This does not work:
LOGICAL Parameter I_AM_64BIT = (INT_PTR_KIND() == 8)
.
.
.
if ( I_AM_64Bit) then
print 3
3 format ( "yes" )
end if
On a 64 bit machine I_AM_64 is 0 and the contents of the if loop are not processed.
Renee
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I'm about to order Metcalf, Reid, and Cohen's latest edition
http://www.oup.com/us/catalog/general/subject/ComputerScience/ProgrammingLanguageTheory/?view=usa&ci=9780199601424
as I have a credit at Amazon, and they seem to have stopped expiring my balances.
It's not exactly an easy jump from Fortran 77, but it's one of the more accessible all-round references.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
You did not copy what I wrote exactly - you left out characters. This works:
[fortran]LOGICAL, PARAMETER :: I_AM_64BIT = (INT_PTR_KIND() == 8) if ( I_AM_64Bit) then print 3 3 format ( "yes" ) end if end[/fortran]
[plain]E:Projects>ifort r.f90 Intel Visual Fortran Intel 64 Compiler XE for applications running on Intel 64, Version 12.0.1.127 Build 20101116 Copyright (C) 1985-2010 Intel Corporation. All rights reserved. Microsoft Incremental Linker Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. -out:r.exe -subsystem:console r.obj E:Projects>r.exe yes E:Projects>[/plain]
[plain]E:Projects>ifort r.f90 Intel Visual Fortran Compiler XE for applications running on IA-32, Version 12.0.1.127 Build 20101116 Copyright (C) 1985-2010 Intel Corporation. All rights reserved. Microsoft Incremental Linker Version 10.00.30319.01 Copyright (C) Microsoft Corporation. All rights reserved. -out:r.exe -subsystem:console r.obj E:Projects>r.exe E:Projects>[/plain]
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
call setupexit ! Call the routine which exits rel cleanly from the
c window which contains it.
call GET_ENVIRONMENT_VARIABLE('ProgramFiles(x86)', value1, len,
1 status)
If ( value1 .eq. 'C:\Program File') then
i_am_64bit = true
end if
True and false have been defined correctly....by .true. and .false.(I don't believeI needed to do this when I was at DEC.)
Your running AI32?
Renee
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I am running Windows 7 x64. The test you are using is not the one I have suggested and you have again not written it correctly, and seem to be confused regarding TRUE and FALSE.
The named constants TRUE and FALSE are to be used when calling Windows API routines, as they have different values, by default, than the Fortran LOGICAL constants .TRUE. and .FALSE.. You are calling a Fortran intrinsic procedure for which the STATUS argument is an integer. It is not a TRUE/FALSE value.
The following does what you want:
[fortran]character(80) env
integer status
integer len
call get_environment_variable("ProgramFiles(x86)",env,len,status)
if (status == 0) then
print *, "System is 64-bit"
else
print *, "System is 32-bit"
end if
end[/fortran] You don't want to test the value as it is language-dependent. But I will also say that this test adds no value to the user. You have not explained what you will do with this information.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
did you ever consider the API routine GetSystemInfo? The SYSTEM_INFO structure that you can obtain with it has the member %wProcessorArchitecture and that shows wether you are running on a x64, an IA64, an x86(Intel) or an IA32_on_win64 o.s.
Robert
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable