! Unmanaged (native Win32) Fortran 95 DLL
subroutine Int4 (IvarIn,Ivar)
	implicit none
	dll_export :: Int4  ! export subroutine name  

	! variable declarations
    integer, intent (in) :: IvarIn
	integer, intent (out) :: Ivar

	! executable statements
	Ivar = IvarIn * 50
end subroutine Int4

subroutine Real4 (RvarIn,Rvar)
	implicit none
	dll_export :: Real4  ! export subroutine name

	! variable declarations
	real, intent (in) :: RvarIn
	real, intent (out) :: Rvar

	! executable statements
	Rvar = RvarIn * 50.5
end subroutine Real4

subroutine Char1 (CvarIn,Cvar)
	implicit none
	dll_export :: Char1  ! export subroutine name  

	! variable declarations
	character (len=5), intent (in) :: CvarIn
	character (len=10), intent (out) :: Cvar

	! executable statements
	Cvar = repeat(trim(CvarIn),2)
end subroutine Char1

subroutine DTpass (DTIvarIn,DTRvarIn,DTCvarIn,DTIvar,DTRvar,DTCvar)
	implicit none
	dll_export :: DTpass  ! export subroutine name  

	! variable declarations
	integer, intent (in) :: DTIvarIn
	real, intent (in) :: DTRvarIn
    character(len=10), intent (in) :: DTCvarIn
	integer, intent (out) :: DTIvar
	real, intent (out) :: DTRvar
    character(len=10), intent (out) :: DTCvar
	type DT1
	    integer :: ii
	    real :: rr
	    character(len=10) :: ch
	end type DT1
	type(DT1) :: DT

	! executable statements
	DT = DT1(DTIvarIn,DTRvarIn,DTCvarIn)
	
	! Because passing a derived type to managed code is not
	! yet supported, we have to pass each component of the
	! derived type in an equivalent variable.
    DTIvar = DT%ii * 50
    DTRvar = DT%rr * 50.5
    DTCvar = repeat(trim(DT%ch),2)
end subroutine DTpass

subroutine CharArrayDim2 (CarrIn,Carr)
	implicit none
	dll_export :: CharArrayDim2  ! export subroutine name  

	! variable declarations
    character, dimension(2,3), intent (in) :: CarrIn
    character, dimension(3,2), intent (out) :: Carr

	! executable statements
    Carr = transpose(CarrIn)
end subroutine CharArrayDim2
