fortran problem

this is my subroutine

subroutine selfile(name)

! call Window dialog to select file

use dfwin
implicit none
integer :: lStructSize
integer :: hwndOwner
integer :: hInstance
integer :: lpstrFilter
integer :: lpstrCustomFilter
integer :: nMaxCustFilter
integer :: nFilterIndex
integer :: lpstrFile
integer :: nMaxFile
integer :: lpstrInitialDir
integer :: lpstrTitle
integer :: Flags
integer :: lpstrDefExt
integer :: lpfnHook
integer :: lpTemplateName
integer :: nMaxFileTitle

type(T_OPENFILENAME):: ofn
character100 filter_spec
512 file_spec
integer status

! set filter specification and string to return the file specification.

filter_spec = ‘Data Files’C//’.dat’C// &
‘Text Files’C//’
.txt’C// &
‘All files’C//’*‘C//’'C
ofn%lStructSize = SIZEOF(ofn)
ofn%hwndOwner = NULL
ofn%hInstance = NULL
ofn%lpstrFilter = loc(filter_spec)
ofn%lpstrCustomFilter = NULL
ofn%nMaxCustFilter = 0
ofn%nFilterIndex = 1
ofn%lpstrFile = loc(file_spec)
ofn%nMaxFile = sizeof(file_spec)
ofn%nMaxFileTitle = 0
ofn%lpstrInitialDir = NULL
ofn%lpstrTitle = loc('D Y N S I M’C)
ofn%lpstrDefExt = loc('dat’C)
ofn%lpfnHook = NULL
ofn%lpTemplateName = NULL

! Call GetOpenFileName and check status

status = GetOpenFileName(ofn)
if (status == 0) then
end subroutine selfile

i am getting these errors:—

Illegal use of constant “D Y N S I M”
Illegal number or type of arguments to loc
Illegal use of constant “dat”
Illegal number or type of arguments to loc
Argument number 1 to getopenfilename: type mismatch
Illegal use of derived type
Illegal argument to %VAL or %LOC

You are trying to apply the LOC function to constants.

i am using PGI visual fortran 2008 with visual studio 2008…is it correct compiler??

which is the good compiler for CUDA FORTRAN.

Hi Kuldeep Gupta,

i am using PGI visual fortran 2008 with visual studio 2008…is it correct compiler??

For CUDA Fortran you need PGI version 2010 or later. CUDA Fortran also requires a “PGI Accelerator” license which enables the compiler’s GPU features. If you are unclear as to the capiblities of your product, please send a note to PGI Customer Service ( and include the license PIN number.

  • Mat