I want to be able to call CLEARWIN routines from a Visual Studio C++ program. Since VS C++ appears to only recognise external FTN95 Siverfrost routines I have attempted to set up a simple FTN95 Siverfrost subroutine in VS FTN95/Clearwin as a project using CtoFORTDRAW.f below which is then linked to a VS C++ project using CtoFORT.cpp below. I have followed the Siverfrost example in the Samples/Win32 section in Help but have encoutered many inconsistencies and of course I have not managed to get a successful Build.
The simple programs below work OK in Siverfrost FTN95 and Siverfrost C++ if the commented out pragma library line is added.
Any suggestions.
Martin West
//CtoFORT.cpp Demostrates calling FTN95 Subroutine from a C++ Program //#pragma library 'CtoFORTDRAW.OBJ'
extern 'C' void DRAWLINE(int *x1, int *y1, int *x2, int *y2); int main() { int x1=0; int y1=0; int x2=500; int y2=500;
DRAWLINE(&x1,&y1,&x2,&y2);
}
//============================================== C CtoFORTDRAW.F C See CtoFORT.CPP which calls this routine SUBROUTINE DRAWLINE(x1,y1,x2,y2) INCLUDE <WINDOWS.INS> INTEGER x1,y1,x2,y2 ICNTRL=-1 L=WINIO@('%ww&') L=WINIO@('%ca[CtoFORTDRAW Draw toutine called from C++]&') L=WINIO@('%lw&',ICNTRL) L=winio@('%gr[WHITE]',600,400)
CALL DRAW_LINE_BETWEEN@(x1,y1,x2,y2,0)
END