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

Version Resource - 64 bit compiles

lklawrie
Beginner
2,089 Views
Been happily using the Version resource in my release builds for many years. Now, we need to put out a 64 bit version.

so (after reinstalling Visual Studio in order to remove SP 1 and be able to access 64 bit versions), I am getting several errors and one which stops the build.

the build stopper:
D:\\EPPgm\\IVF\\EnergyPlus-64\\EnergyPlus.f90(604): error #6580: Name in only-list does not exist. [VERSIONQUERYVALUE]
use ifwbase, only: VersionQueryValue

The rest I can look into:
D:\\EPPgm\\IVF\\EnergyPlus-64\\EnergyPlus.f90(653): warning #6075: The data type of the actual argument does not match the definition. [GHINSTANCE]
ret = GetModuleFileName (ghInstance, szFullPath, len(szFullPath))
---------------------------^
D:\\EPPgm\\IVF\\EnergyPlus-64\\EnergyPlus.f90(660): warning #6075: The data type of the actual argument does not match the definition. [INT]
hMem = GlobalAlloc(GMEM_MOVEABLE, INT(dwVerInfoSize))
---------------------------------------^
D:\\EPPgm\\IVF\\EnergyPlus-64\\EnergyPlus.f90(661): warning #6075: The data type of the actual argument does not match the definition. [HMEM]
lpstrVffInfo = GlobalLock(hMem)
--------------------------------^
D:\\EPPgm\\IVF\\EnergyPlus-64\\EnergyPlus.f90(662): warning #6075: The data type of the actual argument does not match the definition. [LPSTRVFFINFO]
ret = GetFileVersionInfo (szFullPath, dwVerHnd, dwVerInfoSize, lpstrVffInfo)
--------------------------------------------------------------------^
D:\\EPPgm\\IVF\\EnergyPlus-64\\EnergyPlus.f90(703): warning #6075: The data type of the actual argument does not match the definition. [HMEM]
retlock = GlobalUnlock(hMem)
----------------------------^
D:\\EPPgm\\IVF\\EnergyPlus-64\\EnergyPlus.f90(704): warning #6075: The data type of the actual argument does not match the definition. [HMEM]
ret = GlobalFree(hMem)


I noticed the resource types (add resource) only reference 32 bit os.

Is there some new way to be able to embed a version number for a 64 bit exe?

Linda

0 Kudos
1 Solution
Steven_L_Intel1
Employee
2,089 Views
I think that VersionQueryValue is an obsolete API from 16-bit Windows that was not carried over to x64. Use VerQueryValue instead. Look it up to see if the arguments have changed.

The other problems you have are due to handles being declared as INTEGER*4 rather than INTEGER(HANDLE).

View solution in original post

0 Kudos
4 Replies
Steven_L_Intel1
Employee
2,090 Views
I think that VersionQueryValue is an obsolete API from 16-bit Windows that was not carried over to x64. Use VerQueryValue instead. Look it up to see if the arguments have changed.

The other problems you have are due to handles being declared as INTEGER*4 rather than INTEGER(HANDLE).
0 Kudos
lklawrie
Beginner
2,089 Views
Thanks, as always, Steve.

That looks like it will do it.

Linda
0 Kudos
pbkenned1
Employee
2,089 Views
Yes, VerQueryValue compiles on Intel64, the interface is defined in version.f90

program U78030

use version

integer(BOOL) :: VQueryV

integer(LPVOID) :: pBlock ! LPVOID pBlock

character (len=37) lpSubBlock /"root block\\VarFileInfo\\StringFileInfo"C/

integer(LPVOID) :: lplpBuffer ! LPVOID* lplpBuffer

integer(LPUINT) :: puLen ! PUINT puLen

VQueryV = VerQueryValue(pBlock, lpSubBlock, lplpBuffer, puLen)

end program U78030

Don't try to run the above; you need to call GetFileVersionInfoSize and GetFileVersionInfo to get the appropriate resource info before calling VerQueryValue.

Patrick Kennedy
Intel Developer Support

0 Kudos
lklawrie
Beginner
2,089 Views
Any chance we could get a complete (very small) example file to illustrate this use?

I'm coming up empty.

Linda
0 Kudos
Reply