LIB: Difference between revisions

337 bytes added ,  26 July 2021
→‎Client code example: little enhancements and better comments in test_generic_client.f90 code
(→‎Host code example: fix position of -ldl in gfortran compile/link line)
(→‎Client code example: little enhancements and better comments in test_generic_client.f90 code)
Line 122: Line 122:
! This reads single data files which have a header of 7680 bytes
! This reads single data files which have a header of 7680 bytes
! Kay Diederichs 4/2017
! Kay Diederichs 4/2017
! Kay Diederichs 7/2021 add code for the case that fn_template has no '?', and simplify&comment gfortran command.
!
! compile with
! compile with
! ifort -fpic -shared -static-intel -qopenmp -traceback -sox test_generic_client.f90 -o libtest_generic_client.so
! ifort -fpic -shared -static-intel -qopenmp -qopenmp-link=static -traceback -sox test_generic_client.f90 -o libtest_generic_client.so
! (this includes all required compiler libraries into the libtest_generic_client.so library)
! or
! or
! gfortran -c -fpic test_generic_client.f90 && ld -shared test_generic_client.o -L/usr/lib/gcc/x86_64-redhat-linux/4.8.5/ -lgfortran -o libtest_generic_client.so
! gfortran -fpic test_generic_client.f90 -shared -o libtest_generic_client.so
! (attention: the above - from "gfortran" to "libtest_generic_client.so" - is one looong line)
! (this does not include the compiler's libgfortran.so and libquadmath.so into the library; don't know how to achieve this so
! gfortran is only useful if it is anyway installed on the machine)
! The resulting file can be used with a LIB=./libtest_generic_client.so line in XDS.INP, and enables
! The resulting file can be used with a LIB=./libtest_generic_client.so line in XDS.INP, and enables
! reading of data files with a 7680 bytes header plus 1024*1024 pixels of integer data, without any record structure.
! reading of data files with a 7680 bytes header plus 1024*1024 pixels of integer data, without any record structure.
Line 154: Line 158:
       firstqm=INDEX(fn_template,'?')
       firstqm=INDEX(fn_template,'?')
       lastqm =INDEX(fn_template,'?',BACK=.TRUE.)
       lastqm =INDEX(fn_template,'?',BACK=.TRUE.)
      IF (firstqm==0) THEN
        firstqm=lenfn-7
        lastqm =lenfn-4
      END IF
       WRITE(cformat(3:5),'(i1,a1,i1)')lastqm-firstqm+1,'.',lastqm-firstqm+1
       WRITE(cformat(3:5),'(i1,a1,i1)')lastqm-firstqm+1,'.',lastqm-firstqm+1
END SUBROUTINE plugin_open
END SUBROUTINE plugin_open
2,652

edits