program DLLtester

use SharedVariables
use ifwin

implicit none

integer*4         hlb,iret

pointer           (cpaddr,calcpi)

character*1       ch

!*******************************************************************************

hlb = loadlibrary('..\..\CalcPi\Debug\calcpi.dll'//char(0))
if(hlb==0)then
   type *,"Can't find CalcPi.DLL"
   accept *, ch
   call exit
end if

cpaddr = getprocaddress(hlb,"CALCPI"C)
if(cpaddr==0)then
	type *,"Can't locate CalcPi in CalcPi.DLL"
   accept *, ch
	iret = freelibrary(hlb)
	call exit
end if

numerator = 355.0
denominator = 113.0

call CalcPi

iret = freelibrary(hlb)
   
type *, pi
accept *, ch
   
end program DLLtester

