I have been trying to convert a user application to FTN95 .NET, and am having a problem getting ThreadStart delegate coded properly. Following code works except the instantiation of the AppStart object.
! TDTM - .NET Test Program
! Namespace Name
MODULE UserApp
LIBRARY 'System.dll'
LIBRARY 'System.Data.dll'
LIBRARY 'System.Drawing.dll'
LIBRARY 'System.Windows.Forms.dll'
LIBRARY 'SciPlot.dll'
ASSEMBLY_EXTERNAL(name='System.Console.ReadLine') ReadLine
ASSEMBLY_EXTERNAL(name='SciPlot.SP.EVTAPP') EVTAPP
ASSEMBLY_EXTERNAL(name='SciPlot.SPIde.IDEBEG') IDEBEG
ASSEMBLY_EXTERNAL(name='SciPlot.SPIde.IDERTN') IDERTN
! Class Fields
INTEGER(4):: IdeFlag
END MODULE UserApp
! User Application:
SUBROUTINE AppMain(Flag)
USE UserApp
IMPLICIT NONE
INTEGER(4) :: rtnsts,Flag
STRING :: line
OBJECT('System.Exception') se
OBJECT('System.Threading.ThreadAbortException') te
TRY
! Code will be added here......
IF (IdeFlag.EQ.0) THEN
line = ReadLine()
rtnsts = IDERTN(2)
END IF
IF (IdeFlag.EQ.1) THEN
rtnsts = IDERTN(0)
END IF
CATCH (te)
! User has pressed the 'Halt' button
CATCH (se)
! Report exception in AppMain and terminate
CALL EVTAPP(se)
END TRY
END SUBROUTINE AppMain
! Main Program
PROGRAM MAIN
USE UserApp
IMPLICIT NONE
EXTERNAL AppMain
! Local variables definition
INTEGER(4) :: rtnsts
STRING :: line
OBJECT('System.Exception') se
OBJECT('SciPlot.SPIde') IdeForm
OBJECT('System.Threading.ThreadStart') AppStart
! SciPlot SPIde Class Instantiation
IdeFlag = 1
IF (IdeFlag.EQ.0) THEN
IdeForm = NEW@('SciPlot.SPIde',0)
END IF
IF (IdeFlag.EQ.1) THEN
IdeForm = NEW@('SciPlot.SPIde',1)
END IF
! Following fortran code fails to compile...
! AppStart = NEW@('System.Threading.ThreadStart',AppMain)
! Equivalent C# code
! public static ThreadStart AppStart = new ThreadStart(AppMain);
TRY
! Start SPIde Control Form
rtnsts = IDEBEG(AppStart)
STOP
CATCH (se)
! Report exception in Main Program
CALL EVTAPP(se)
ENDTRY
END PROGRAM
If anyone has an idea how to code it, please help me.
F Vote