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

Debug problem

nvaneck
New Contributor I
1,214 Views

In the following code calling program is the initial lines for my complete and much larger project. The subroutine is a test section which appears in two of my project routines.

When my project is running in 32-bit release mode, 64-bit release mode, and 64-bit debug mode, everything works fine. When running in 32-bit debug mode, the program bombs on the shellexecuteex call with an access exception.

When running the code below as a separate project, it works in all modes.

Any suggestions as what cause this?

The examplewas set up to invoke test as the first executable in my project, which I tried to eliminate other code sources as the problem. The program OSIRIS has the exact first lines of the real project.

Using Fortran version 10.1, VS 2005

Thanks!


PROGRAM OSIRIS
USE IFQWIN; USE IFLOGM; USE SPACE

USE SPACE
SAVE
INCLUDE 'RESOURCE.FD'

CHARACTER COMMAND_LINE*256,DDNAME*8,TIME_NOW*8

LOGICAL(4) IFOLD,RESULT,SYSEOF,EXIST,INUSE,RETLOG,FATAL

INTEGER(4) WINCMD,SFIND

TYPE (QWINFO) WINFO

TYPE (DIALOG) DLG

CALL TEST
END


SUBROUTINE TEST

USE IFWIN

TYPE (T_SHELLEXECUTEINFO):: SEI

CHARACTER FILENAME*256

FILENAME='TEST.XLT'C
SEI.cbSize = SIZEOF(SEI)
SEI.fMask = SEE_MASK_NOCLOSEPROCESS
SEI.lpVerb = NULL ! = open
SEI.lpFile = LOC(FILENAME)
I=ShellExecuteEx(SEI)
IF (I.EQ.0) THEN
iErr = GetLastError();RETURN
ELSE
WRITE(*,*) 'Waiting for Excel to finish....'
i = WaitForSingleObject(SEI.hProcess, INFINITE)
i = CloseHandle(SEI.hProcess)
WRITE(*,*) 'OK'
END IF
END

0 Kudos
4 Replies
Steven_L_Intel1
Employee
1,214 Views

I can't reproduce the problem using 10.1.031. (I had to add an empty dialog resource and comment out the USE of module SPACE.) However, I note that you have not zeroed out the other fields of SEI - you cannot depend on them being zero.
0 Kudos
nvaneck
New Contributor I
1,214 Views

I can't reproduce the problem using 10.1.031. (I had to add an empty dialog resource and comment out the USE of module SPACE.) However, I note that you have not zeroed out the other fields of SEI - you cannot depend on them being zero.

I'll try zeroing them out; thanks for the tip. You can't reproduce it because the example works--it just doesn't work in my larger real project--which is exactly the same code but has a lot of code following the test call to TEST. I was thinking it related to the size of the real project somehow, and your suggestion might be the answer. I took the code from a forum example a long time ago and didn't consider other fields. I did see that several fields in SEI looked like large negative numbers.
0 Kudos
Paul_Curtis
Valued Contributor I
1,214 Views
Quoting - nvaneck

I'll try zeroing them out...

CALL ZeroMemory (LOC(sei), SIZEOF(sei))

does the entire job without bothering with subcomponents
0 Kudos
nvaneck
New Contributor I
1,214 Views
Quoting - Paul Curtis

CALL ZeroMemory (LOC(sei), SIZEOF(sei))

does the entire job without bothering with subcomponents

Great tip! I zeroed them out and it fixed it (unfortuantely, I didn't see your tip in time to save extra effort, but I'm using it now.). In the 64bit debug run, I found they were already 0; in the 32bit debug they were the invalid address accessed.

Thanks to both you and Steve it's cleaned up.

Neal
0 Kudos
Reply