Knowledge Base

BUG: Sample MTTEST.FOR Compile Errors

PSS ID Number: 118338

Article Last Modified on 11/2/1999


The information in this article applies to:


This article was previously published under Q118338

SYMPTOMS

When you compile the multithread example MTTEST.FOR, the compiler generates the following error messages:
MTTEST.FOR(12) : error F2328: CREATETHREAD : already typed
MTTEST.FOR(12) : error F2328: WAITFORMULTIPLEOBJECTS : already typed
MTTEST.FOR(19) : error F2611: CREATETHREAD : formal argument THREAD_FUNC : actual not subprogram

CAUSE

The sample program contains two errors.

  • CreateThread() and WaitForMultipleObjects() are declared. This is not necessary, because the correct declarations are already in the include file, MT.FD.
  • CreateThread() is passed the location of the routine rather than the routine itself.

RESOLUTION

The CreateThread() and WaitForMultipleObjects() declarations are not needed and should be removed. Delete the line 12 from MTTEST.FOR:
   integer*4   CreateThread, WaitForMultipleObjects
				
CreateThread() expects a subprogram, not a location. Remove the syntax "LOC()" from line 19 of MTTEST.FOR:
   handle(i) = CreateThread (0, 0, LOC (Task), temp(i), 0, myid)
				
After the correction is made, the line will be as follows:
   handle(i) = CreateThread (0, 0, Task, temp(i), 0, myid)
				
In addition to the actual errors, the program takes an unnecessarily long time to run. The number of milliseconds it waits in the "task" routine should be reduced from 10000 to 1000 or less. In MTTEST.FOR, change
   call sleepqq(10000*seq)
				
-to-
   call sleepqq(1000*seq)
				

STATUS

Microsoft has confirmed this to be a bug in the FORTRAN PowerStation 32 for Windows NT, version 1.0. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

Additional query words: 1.00

Keywords: kberrmsg kbLangFortran KB118338
Technology: kbAudDeveloper kbFORTRANPower32100NT kbFortranSearch kbZNotKeyword2