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

to LOC or not to LOC...

anthonyrichards
New Contributor III
475 Views
Again, when looking for code to crib to write multithreading code, I found this and used it to start a thread:
Code:
         hThread1 = CreateThread (NULL_SECURITY_ATTRIBUTES, 0,   &
                              LOC(ThreadProc),                   &
                              LOC(pColor1), 0,                   &
                              LOC(ThreadID1))
However, when I tried to compile it, the compiler objected to the 'LOC's saying it was the wrong type of object. By trial and error, I had to change the code to
Code:
		 hThread1 = CreateThread (NULL, 0, &
                              ThrdProc,            &
                              Dummy, 0,            &
                              ThreadID1)
before it would compile correctly. Why is this? I am using CVF 6.6C.
This problem indicates that there will be a lot ofsample codes that willsimilarly fail, IMO.
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
475 Views
There are two declarations of CreateThread in CVF -- one in KERNEL32 and one in DFMT. Your first call conforms to the former, and the second to the latter. Personally, I consider DFMT "obsolescent" -- the one in Kernel32 is more consistent withother APIs.
(There's also ALLOW_NULL for lpThreadAttributes in Kernel32 version, so you may pass plain NULL() instead of NULL_SECURITY_ATTRIBUTES).
Jugoslav
0 Kudos
Reply