Here is a copy of a post and the solution I also posted to Silverfrost's FTN95 Forum which may be of help to other VPE users
---------------------------------------------------------------------------------------------------------------------------------------------------------------
My Question:
Has anyone experience of using VPE with FTN95?
I can envisage doing it by writing a custom interface of C/C++ routines to match each of the VPE library routines but there must be a simpler way!
The general form taken by VPE routines is:
// Type of VPE Handles
typedef void * VpeHandle;
// Open new document
VpeHandle hdoc = VpeOpenDoc( NULL, "Test", 0 );
// Write text line to document
VpeWriteLine( hdoc, ix, iy, "Some message at specified page coords" );
So the question is: can the VpeHandle hdoc pointer be captured by an initial C_EXTERNAL call from within a FTN95 subroutine in the form
C_EXTERNAL VPEOPEN 'VpeOpenDoc' (REF, OUTSTRING, VAL)
and then text line written with
C_EXTERNAL VPEWRITE 'VpeWriteLine' (REF, VAL, VAL, OUTSTRING)
and, if so, would the REF be a Fortran long integer variable?
---------------------------------------------------------------------------------------------------------------------------------------------------------------
My solution
After a day's trial and error, the following worked:
PROGRAM VPETEST
STDCALL VPEOPENDOC 'VpeOpenDoc' (VAL,INSTRING,VAL) : INTEGER*4
STDCALL VPEWRITEBOX 'VpeWriteBox' (VAL,VAL,VAL,VAL,VAL,INSTRING)
STDCALL VPELINE 'VpeLine' (VAL,VAL,VAL,VAL,VAL)
STDCALL VPEWRITEDOC 'VpeWriteDoc' (VAL,INSTRING)
!
INTEGER*4 HDOC
REAL*8 X1,X2,X3,X4,Y1,Y2,Y3,Y4
DATA X1/1.0D0/,Y1/1.0D0/,X2/5.0D0/,Y2/1.5D0/
DATA X3/1.5D0/,Y3/3.0D0/,X4/5.0D0/,Y4/6.5D0/
!
HDOC = VPEOPENDOC(0,"TEST",0)
CALL VPEWRITEBOX(HDOC,X1,Y1,X2,Y2,"Hello Aldavhu221!")
CALL VPELINE(HDOC,X3,Y3,X4,Y4)
CALL VPEWRITEDOC(HDOC,"Hello_221.pdf")
!
STOP
END
I would be pleased to discuss successes and issues with anyone else combining FTN95 and the Ideal Software Virtual Print Engine which is truly an awesome DLL commercial library, enabling reports to be produced in RTF and PDF formats in the most intrincate detail.