mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-02-23 16:20:57 +08:00
Added SEQUENCE to derived types for NAG:
Section 81 of the compiler manual, e.g. at http://www.nag.co.uk/nagware/np/r61_doc/np61_manual.pdf covers details about the compiler's internal representations, including " Fortran derived types are translated into C structs. If BIND(C) or SEQUENCE is used, the order of the items within the struct is the same as the order within the derived type definition. Otherwise, the order of items is permuted to put larger types at the front of the struct so as to improve alignment and reduce storage; the C output code can be inspected to determine the ordering used. " Removed INTENT(IN) to fix segfaults in C APIs for TYPE(C_PTR). Tested: NAG (gnu)
This commit is contained in:
parent
7cbf491e29
commit
7b056aadff
@ -376,7 +376,8 @@ CONTAINS
|
||||
INTEGER(size_t), INTENT(in) :: dst_size ! The size of the structure type
|
||||
INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_offset ! An array containing the offsets of the fields
|
||||
INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_sizes ! An array containing the sizes of the fields
|
||||
TYPE(C_PTR), INTENT(OUT) :: dst_buf ! Buffer with data
|
||||
TYPE(C_PTR) :: dst_buf ! Buffer with data !! do not use INTENT, causes NAG
|
||||
! to segfault in C APIs
|
||||
INTEGER :: errcode ! error code
|
||||
|
||||
INTEGER(size_t) :: namelen ! name length
|
||||
|
@ -561,6 +561,7 @@ SUBROUTINE test_table2()
|
||||
INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(10) ! This should map to REAL*8 on most modern processors
|
||||
|
||||
TYPE particle_t
|
||||
SEQUENCE
|
||||
CHARACTER(LEN=11) :: name
|
||||
INTEGER(KIND=i8) :: lati
|
||||
INTEGER(KIND=i16) :: long
|
||||
@ -671,11 +672,10 @@ SUBROUTINE test_table2()
|
||||
|
||||
f_ptr1 = C_NULL_PTR
|
||||
f_ptr2 = C_LOC(fill_data(1)%name(1:1))
|
||||
|
||||
CALL h5tbmake_table_f("Table Title Fill", file_id, table_name_fill, nfields, nrecords, &
|
||||
dst_size, field_names, dst_offset, field_type, &
|
||||
chunk_size, f_ptr2, compress, f_ptr1, errcode )
|
||||
|
||||
|
||||
f_ptr3 = C_LOC(r_data(1)%name(1:1))
|
||||
CALL h5tbread_table_f(file_id, table_name_fill, nfields, dst_size, dst_offset, dst_sizes, f_ptr3, errcode)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user