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

Pointer to structure in Windows API call

Lewallen__Roy
Novice
1,797 Views

The following code has been working when compiled withCVF 6.6, and it runs fine when compiled for release with the latest IVF 9.1 revision. But when it's compiled for debug, it throws the following error:

"forrtl severe (408): fort: (7): Attempt to use pointer NULL_SECURITY_ATTRIBUTES when it is not associated with a target."

Here's the code, a call to the Windows API function CreateFile:

NULLIFY(NULL_SECURITY_ATTRIBUTES)

hFileHandle = CreateFile(TRIM(strFileSpec)//CHAR(0),
& intRWB,0,
& NULL_SECURITY_ATTRIBUTES,
& intCreate,0,NULL)

Commenting out the NULLIFY statement doesn't make any difference. The subroutine contains a USE IFWIN statement. I get a similar error with NULL_OVERLAPPED in a WriteFile call. It also works fine when compiled for release.

If this really is an error, can someone please explain what's causing it and how to fix it? If it's not, I'd like to know how to suppressthe error reportso I can use the debugger to spot real errors.

Thanks!

0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,797 Views

My guess is that you have turned on additional run-time checks, includng /check:pointer. NULL_SECURITY_ATTRIBUTES is a pointer to type T_SECURITY_ATTRIBUTES so it sees that you are fetching the value of a null pointer and giving the error.

You no longer need to use the NULL_xxx values in most cases, including this one. Just use NULL instead.

0 Kudos
Lewallen__Roy
Novice
1,797 Views

I had the run-time checks to All. Changing NULL_SECURITY_ATTRIBUTES and NULL_OVERLAY to plain NULL eliminated the error messages. Thanks!

0 Kudos
Reply