I supply a procedure name and a parameter to be used:-
THandle = CREATETHREAD (0, 0 ,sched_ServerThread ,IntegerParameter ,0 ,ThreadID)
Once the thread has started, the "sched_serverThread" subroutine is executed
In this subroutine, the supplied parameter (SystemNum defined as Integer*4) has an"undefined address", thus causing a few poblems in the subsequent code.
I presume I am doing something obviously incorrect?
INTEGER(HANDLE) FUNCTION sched_ServerThread(SystemNum)
!DEC$ ATTRIBUTES STDCALL, ALIAS:"_systemnum" :: SystemNum
INTEGER(4), POINTER :: SystemNum
END FUNCTION sched_ServerThread
And have the above interface visible to both the caller and the callee
You had two basic problems:
You did not declare STDCALL calling conventions
You use subroutine when function was required
You may be able to eliminate POINTER on SystemNum. I had it in there for use back in V8.nn when the supplied interface declarations of the Windows API was in error.
Thanks for the attempt, but I seem to have a few problems implementing your solution.
I did change the subroutine to Integer function, thentried to compile with the supplied interface. The compiler finds that the SystemNum variable isfound to have been defined more than once with conflicting attributes. Commenting out the Pointer defintion had no effect.
It seems to me that the stdcall attribute would be used to interface to a C routine (which this is not) and that therefore the Alias clause should refer to the C alias to the fortran function (the C routine does not exist).
With that in mind I changed the Interface defintion to exclude the atttributes stdcall defintion. It then compiled OK, but failed to have any affect on the original problem.