External shared libraries can be build in many ways. Describing all available
manners is not the aim of this section. This is a description on how to build a
shared library with the supported compiler using the command line.
To create a shared library from source using the supported fortran compiler
ifort use the following command:
ifort <
Where:
mt.exe -manifest usrlib.manifest -outputresource:usrlib;2
(Fortran)
SUBROUTINE ELSEUS( EPS, NSTR, SE )
!DEC$ ATTRIBUTES DLLEXPORT::ELSEUS
!
! PURPOSE : User supplied tangential [SE] - matrix
!
INTEGER NSTR
DOUBLE PRECISION EPS(*), SE(NSTR,*)
!
DOUBLE PRECISION YOUNG
!
YOUNG = 1.D3
DO 100, I=1,NSTR
DO 100, J=1,NSTR
100 SE(J,I) = 0.0D0
!
IF ( NSTR.EQ.4 ) THEN
SE(1,1) = YOUNG + 2000.D0 * YOUNG * EPS(1)
SE(2,2) = YOUNG + 2000.D0 * YOUNG * EPS(2)
SE(3,3) = YOUNG + 2000.D0 * YOUNG * EPS(3)
SE(4,4) = 0.5 * YOUNG
END IF
!
END
SUBROUTINE ELSGUS( EPS, NSTR, TSIG )
!DEC$ ATTRIBUTES DLLEXPORT::ELSGUS
!
! PURPOSE : USER SUPPLIED TOTAL STRESSES
!
INTEGER NSTR
DOUBLE PRECISION EPS(NSTR) , TSIG(NSTR)
!
DOUBLE PRECISION YOUNG
!
YOUNG = 1.D3
IF ( NSTR.EQ.4 ) THEN
TSIG(1) = YOUNG * EPS(1) + 1000.D0 * YOUNG * EPS(1) ** 2
TSIG(2) = YOUNG * EPS(2) + 1000.D0 * YOUNG * EPS(2) ** 2
TSIG(3) = YOUNG * EPS(3) + 1000.D0 * YOUNG * EPS(3) ** 2
TSIG(4) = 0.5 * YOUNG * EPS(4)
END IF
!
END
Please note the "!DEC$ ATTRIBUTES DLLEXPORT" lines in both routines. Without those lines the user supplied routines will not be visible to DIANA on MS-Windows platforms.
For generation of the uscou1.dll shared library file from the
sourcefile elseus.f90 containing two user-supplied
subroutines, ELSEUS
and ELSGUS, on a Windows 64-bit platform the
following command has to be given in the DIANA Command Box:
ifort <
Where <
mt.exe -manifest uscou1.dll.manifest -outputresource:uscou1.dll;2