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

process is not created

sreevani
Beginner
514 Views
Hi, I have written on function like this to create a process...
---------------------------------------------------

logical function supershell (App , workdir)
use dfwin
use dflib

use DefineGlobalVarsModule
implicit none



type (T_STARTUPINFO) :: startupinfo
type (T_PROCESS_INFORMATION) :: processinfo
type (T_SECURITY_ATTRIBUTES) :: securityatt1, securityatt2

character*(MAX_PATH) path
integer ret
character*256 workdir,App,start_size

startupinfo%dwFlags = 0
startupinfo%cb = sizeof(startupinfo)
securityatt1%nLength = sizeof(securityatt1)
securityatt2%nLength = sizeof(securityatt2)

ret = CreateProcess (NULL , & ! Application Name
App, & !'"'//path(1:path_len)//'" -child'C, & ! Command line
NULL_SECURITY_ATTRIBUTES, &
NULL_SECURITY_ATTRIBUTES, &
TRUE, & ! InheritHandles
0, & ! CreationFlags
NULL, & ! Environment variables
"c:mdtwizardgemdt_program", & ! Current directory
startupInfo, &
processInfo)

if (ret == 0) then
ret = GetLastError ()
write (*,'(A,I0)') "Create process failed with error ",ret

else
! CreateProcess succeeded. Wait for the process to finish
!
ret = WaitForSingleObject (ProcessInfo%hProcess,INFINITE)

! Close handles, otherwise resources are lost
!
ret = CloseHandle (ProcessInfo%hThread)
ret = CloseHandle (ProcessInfo%hProcess)
end if

!return
end function supershell

-----------------------------------------------------
when I call this function
integer Ty
working_directory is the current working directory like
c:folder
Ty = supershell('isight',working_directory)
this does not create a thread nor nothing happens I am not able tounderstand why it is happening so...
I tried keeping 'isight' in the working directory also but still it does not work.
Iget an error saying 'isight' has an explicit type and does not have a type.
If i say
Ty = supershell('notepad',working_directory)then it works fine.
how can i get for 'isight' createprocess working????
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
514 Views
Iget an error saying 'isight' has an explicit type and does not have a type.

??? What's the exact error message and the code on that line? You must declare that supershell is a logical function in the calling routine. At least add
logical, external:: supershell
in the routine that calls supershell.
App, & ! Command line
You need a trim(App)//char(0) here instead.
"c:mdtwizardgemdt_program", & ! Current directory
Same here. Add //char(0).

Jugoslav

P.S. Please use {pre}...{/pre} tags from the toolbar in Forum message editor around the code -- that will preserve code formatting, as in my message.
0 Kudos
Reply