summaryrefslogtreecommitdiffstats
path: root/hl/fortran/src/H5HL_buildiface.F90
blob: a556c9d4722a7d972a4da1649785b037b972a726 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
!****p* Program/H5HL_buildiface
!
! NAME
!  Executable: H5HL_buildiface
!
! FILE
!  fortran/src/H5HL_buildiface.f90
!
! PURPOSE
!  This stand alone program is used at build time to generate the program
!  H5HL_gen.f90. It cycles through all the available KIND parameters for
!  integers and reals. The appropriate program and subroutines are then generated
!  depending on which of the KIND values are found.
!
! NOTES
!  This program uses the Fortran 2008 intrinsic function STORAGE_SIZE or SIZEOF
!  depending on availability.It generates code that makes use of
!  STORAGE_SIZE/SIZEOF in H5fortran_detect.f90. STORAGE_SIZE is standard
!  compliant and should always be chosen over SIZEOF.
!
!  The availability of STORAGE_SIZE/SIZEOF is checked at configure time and the TRUE/FALSE
!  condition is set in the configure variable "FORTRAN_HAVE_STORAGE_SIZE" or
!  "FORTRAN_HAVE_SIZEOF".
!
!  The use of C_SIZOF(X) is not used since the argument X must be an interoperable
!  data entity.
!
! COPYRIGHT
!  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
!  Copyright by The HDF Group.                                                 *
!  All rights reserved.                                                        *
!                                                                              *
!  This file is part of HDF5.  The full HDF5 copyright notice, including       *
!  terms governing use, modification, and redistribution, is contained in      *
!  the COPYING file, which can be found at the root of the source code         *
!  distribution tree, or in https://www.hdfgroup.org/licenses.                 *
!  If you do not have access to either file, you may request a copy from       *
!  help@hdfgroup.org.                                                          *
!  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
!
!*****

#include <H5config_f.inc>

PROGRAM H5HL_buildiface
  USE, INTRINSIC :: ISO_C_BINDING
  IMPLICIT NONE

! These values are valid REAL KINDs (with corresponding C float) found during configure
  H5_H5CONFIG_F_NUM_RKIND
  H5_H5CONFIG_F_RKIND
! These values are valid INTEGER KINDs (with corresponding C float) found during configure
  H5_H5CONFIG_F_NUM_IKIND
  H5_H5CONFIG_F_IKIND

  INTEGER :: i, j, k
  CHARACTER(LEN=2) :: chr2
! subroutine rank of array being passed in
  CHARACTER(LEN=2), DIMENSION(1:8), PARAMETER :: chr_rank=(/"_0","_1","_2","_3","_4","_5","_6","_7"/)
! rank definitions
  CHARACTER(LEN=70), DIMENSION(1:8), PARAMETER :: rank_dim_line=(/ &
       '                                                                    ', &
       ', DIMENSION(dims(1))                                                ', &
       ', DIMENSION(dims(1),dims(2))                                        ', &
       ', DIMENSION(dims(1),dims(2),dims(3))                                ', &
       ', DIMENSION(dims(1),dims(2),dims(3),dims(4))                        ', &
       ', DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5))                ', &
       ', DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6))        ', &
       ', DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6),dims(7))' &
            /)
! pointer to the buffer
  CHARACTER(LEN=37), DIMENSION(1:8), PARAMETER :: f_ptr_line=(/ &
       '    f_ptr = C_LOC(buf               )', &
       '    f_ptr = C_LOC(buf(1)            )', &
       '    f_ptr = C_LOC(buf(1,1)          )', &
       '    f_ptr = C_LOC(buf(1,1,1)        )', &
       '    f_ptr = C_LOC(buf(1,1,1,1)      )', &
       '    f_ptr = C_LOC(buf(1,1,1,1,1)    )', &
       '    f_ptr = C_LOC(buf(1,1,1,1,1,1)  )', &
       '    f_ptr = C_LOC(buf(1,1,1,1,1,1,1))' &
            /)

! Generate Fortran H5LT* interfaces having multiple KIND interfaces.
!
! Developer's notes:
!
! Only interfaces with arrays of rank 7 and less are provided. Even-though the F2008
! standard extended the maximum rank to 15, it was decided that they should use the
! new APIs to handle those use cases. Handling rank 7 and less is for backward compatibility
! with the Fortran 90/95 APIs codes which could never handle rank 8-15 array sizes.

  OPEN(11,FILE='H5LTff_gen.F90')
  WRITE(11,'(40(A,/))') &
'!****h* ROBODoc/H5LTff_gen.F90',&
'!',&
'! NAME',&
'!  H5LTff_gen',&
'! ',&
'! PURPOSE',&
'!  This module is generated at build by H5HL_buildiface.F90 to handle all the',&
'!  detected REAL/INTEGER KINDs for APIs being passed those KINDs. Currently these ',&
'!  are H5LT and H5TB APIs',&
'!',&
'! COPYRIGHT',&
'! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *',&
'!   Copyright by The HDF Group.                                               *',&
'!   All rights reserved.                                                      *',&
'!                                                                             *',&
'!   This file is part of HDF5.  The full HDF5 copyright notice, including     *',&
'!   terms governing use, modification, and redistribution, is contained in    *',&
'!   the COPYING file, which can be found at the root of the source code       *',&
'!   distribution tree, or in https://www.hdfgroup.org/licenses.               *',&
'!   If you do not have access to either file, you may request a copy from     *',&
'!   help@hdfgroup.org.                                                        *',&
'! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *',&
'!',&
'! AUTHOR',&
'!   H5HL_buildiface.F90',&
'!',&
'!*****'

  WRITE(11,'(a)') "MODULE H5LT"

  WRITE(11,'(A)') '  USE, INTRINSIC :: ISO_C_BINDING'
  WRITE(11,'(A)') '  USE h5fortran_types'
  WRITE(11,'(A)') '  USE H5LT_CONST'
  WRITE(11,'(A)') '  IMPLICIT NONE'
!***************
! H5LT INTERFACES
!***************
!
! H5LTmake_dataset_f
!
  WRITE(11,'(A)') "  INTERFACE h5ltmake_dataset_f"
  DO i = 1, num_rkinds
     j = rkind(i)
     WRITE(chr2,'(I2)') j
     DO k = 1, 8
        WRITE(11,'(A)') "     MODULE PROCEDURE h5ltmake_dataset_real_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
     ENDDO
  END DO
  DO i = 1, num_ikinds
     j = ikind(i)
     WRITE(chr2,'(I2)') j
     DO k = 1, 8
        WRITE(11,'(A)') "     MODULE PROCEDURE h5ltmake_dataset_integer_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
     ENDDO
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

!  h5ltread_dataset_f
  WRITE(11,'(A)') "  INTERFACE h5ltread_dataset_f"
  DO i = 1, num_rkinds
     j = rkind(i)
     WRITE(chr2,'(I2)') j
     DO k = 1, 8
        WRITE(11,'(A)') "     MODULE PROCEDURE h5ltread_dataset_real_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
     ENDDO
  END DO
  DO i = 1, num_ikinds
     j = ikind(i)
     WRITE(chr2,'(I2)') j
     DO k = 1, 8
        WRITE(11,'(A)') "     MODULE PROCEDURE h5ltread_dataset_integer_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
     ENDDO
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

! h5ltread_dataset_int_f
  WRITE(11,'(A)') "  INTERFACE h5ltread_dataset_int_f"
  DO i = 1, num_ikinds
     j = ikind(i)
     WRITE(chr2,'(I2)') j
     DO k = 1, 8
        WRITE(11,'(A)') "     MODULE PROCEDURE h5ltread_dataset_int_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
     ENDDO
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

!  h5ltmake_dataset_int_f
  WRITE(11,'(A)') "  INTERFACE h5ltmake_dataset_int_f"
  DO i = 1, num_ikinds
     j = ikind(i)
     WRITE(chr2,'(I2)') j
     DO k = 1, 8
        WRITE(11,'(A)') "     MODULE PROCEDURE h5ltmake_dataset_int_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
     ENDDO
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

!  h5ltmake_dataset_float_f
  WRITE(11,'(A)') "  INTERFACE h5ltmake_dataset_float_f"
  DO i = 1, num_rkinds
     j = rkind(i)
     WRITE(chr2,'(I2)') j
     DO k = 1, 8
        WRITE(11,'(A)') "     MODULE PROCEDURE h5ltmake_dataset_float_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
     ENDDO
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

!  h5ltmake_dataset_double_f
  WRITE(11,'(A)') "  INTERFACE h5ltmake_dataset_double_f"
  DO i = 1, num_rkinds
     j = rkind(i)
     WRITE(chr2,'(I2)') j
     DO k = 1, 8
        WRITE(11,'(A)') "     MODULE PROCEDURE h5ltmake_dataset_double_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
     ENDDO
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

!  h5ltread_dataset_float_f
  WRITE(11,'(A)') "  INTERFACE h5ltread_dataset_float_f"
  DO i = 1, num_rkinds
     j = rkind(i)
     WRITE(chr2,'(I2)') j
     DO k = 1, 8
        WRITE(11,'(A)') "     MODULE PROCEDURE h5ltread_dataset_float_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
     ENDDO
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

!  h5ltread_dataset_double_f
  WRITE(11,'(A)') "  INTERFACE h5ltread_dataset_double_f"
  DO i = 1, num_rkinds
     j = rkind(i)
     WRITE(chr2,'(I2)') j
     DO k = 1, 8
        WRITE(11,'(A)') "     MODULE PROCEDURE h5ltread_dataset_double_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
     ENDDO
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

  WRITE(11,'(A)') 'CONTAINS'

!**********************
! H5LT APIs
!**********************
!
! h5ltmake_dataset_f
  DO i = 1, num_rkinds
     k = rkind(i)
     WRITE(chr2,'(I2)') k
     DO j = 1, 8

! DLL definitions for windows
        WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
        WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltmake_dataset_real_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
        WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
        WRITE(11,'(A)') '  SUBROUTINE h5ltmake_dataset_real_kind_'//TRIM(ADJUSTL(chr2))&
             &//'_rank'//chr_rank(j)//'(loc_id,dset_name,rank,dims,type_id,buf,errcode)'
        WRITE(11,'(A)') '    IMPLICIT NONE'
        WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
        WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
        WRITE(11,'(A)') '    INTEGER,          INTENT(IN) :: rank'
        WRITE(11,'(A)') '    INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
        WRITE(11,'(A)') '    INTEGER(hid_t),   INTENT(in) :: type_id'
        WRITE(11,'(A)') '    REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
        WRITE(11,'(A)') '    INTEGER :: errcode '
        WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'
        WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'

        WRITE(11,'(A)') f_ptr_line(j)
        WRITE(11,'(A)') '    namelen = LEN(dset_name)'
        WRITE(11,'(A)') '    errcode = h5ltmake_dataset_c(loc_id,namelen,dset_name,rank,dims,type_id,f_ptr)'
        WRITE(11,'(A)') '  END SUBROUTINE h5ltmake_dataset_real_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     ENDDO
  ENDDO

! h5ltread_dataset_f
  DO i = 1, num_rkinds
     k = rkind(i)
     WRITE(chr2,'(I2)') k
     DO j = 1, 8

! DLL definitions for windows
        WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
        WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltread_dataset_real_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
        WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
        WRITE(11,'(A)') '  SUBROUTINE h5ltread_dataset_real_kind_'//TRIM(ADJUSTL(chr2))&
             &//'_rank'//chr_rank(j)//'(loc_id,dset_name,type_id,buf,dims,errcode)'
        WRITE(11,'(A)') '    IMPLICIT NONE'
        WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
        WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
        WRITE(11,'(A)') '    INTEGER(hid_t),   INTENT(in) :: type_id'
        WRITE(11,'(A)') '    INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
        WRITE(11,'(A)') '    REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
        WRITE(11,'(A)') '    INTEGER :: errcode '
        WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'
        WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'

        WRITE(11,'(A)') f_ptr_line(j)
        WRITE(11,'(A)') '    namelen = LEN(dset_name)'
        WRITE(11,'(A)') '    errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr)'
        WRITE(11,'(A)') '  END SUBROUTINE h5ltread_dataset_real_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     ENDDO
  ENDDO

! h5ltmake_dataset_float_f
  DO i = 1, num_rkinds
     k = rkind(i)
     WRITE(chr2,'(I2)') k
     DO j = 1, 8

! DLL definitions for windows
        WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
        WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltmake_dataset_float_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
        WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
        WRITE(11,'(A)') '  SUBROUTINE h5ltmake_dataset_float_kind_'//TRIM(ADJUSTL(chr2))&
             &//'_rank'//chr_rank(j)//'(loc_id,dset_name,rank,dims,buf,errcode)'
        WRITE(11,'(A)') '    IMPLICIT NONE'
        WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
        WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
        WRITE(11,'(A)') '    INTEGER,          INTENT(IN) :: rank'
        WRITE(11,'(A)') '    INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
        WRITE(11,'(A)') '    REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
        WRITE(11,'(A)') '    INTEGER :: errcode '
        WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'
        WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'

        WRITE(11,'(A)') f_ptr_line(j)
        WRITE(11,'(A)') '    namelen = LEN(dset_name)'
        WRITE(11,'(A)') '    errcode = h5ltmake_dataset_c(loc_id,namelen,dset_name,rank,dims,H5T_NATIVE_REAL,f_ptr)'
        WRITE(11,'(A)') '  END SUBROUTINE h5ltmake_dataset_float_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     ENDDO
  ENDDO

! h5ltread_dataset_float_f
  DO i = 1, num_rkinds
     k = rkind(i)
     WRITE(chr2,'(I2)') k
     DO j = 1, 8

! DLL definitions for windows
        WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
        WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltread_dataset_float_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
        WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
        WRITE(11,'(A)') '  SUBROUTINE h5ltread_dataset_float_kind_'//TRIM(ADJUSTL(chr2))&
             &//'_rank'//chr_rank(j)//'(loc_id,dset_name,buf,dims,errcode)'
        WRITE(11,'(A)') '    IMPLICIT NONE'
        WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
        WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
        WRITE(11,'(A)') '    INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
        WRITE(11,'(A)') '    REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
        WRITE(11,'(A)') '    INTEGER :: errcode '
        WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'
        WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'

        WRITE(11,'(A)') f_ptr_line(j)
        WRITE(11,'(A)') '    namelen = LEN(dset_name)'
        WRITE(11,'(A)') '    errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_REAL,f_ptr)'
        WRITE(11,'(A)') '  END SUBROUTINE h5ltread_dataset_float_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     ENDDO
  ENDDO

! h5ltmake_dataset_double_f
  DO i = 1, num_rkinds
     k = rkind(i)
     WRITE(chr2,'(I2)') k
     DO j = 1, 8
! DLL definitions for windows
        WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
        WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltmake_dataset_double_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
        WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
        WRITE(11,'(A)') '  SUBROUTINE h5ltmake_dataset_double_kind_'//TRIM(ADJUSTL(chr2))&
             &//'_rank'//chr_rank(j)//'(loc_id,dset_name,rank,dims,buf,errcode)'
        WRITE(11,'(A)') '    IMPLICIT NONE'
        WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
        WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
        WRITE(11,'(A)') '    INTEGER,          INTENT(IN) :: rank'
        WRITE(11,'(A)') '    INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
        WRITE(11,'(A)') '    REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
        WRITE(11,'(A)') '    INTEGER :: errcode '
        WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'
        WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'

        WRITE(11,'(A)') f_ptr_line(j)
        WRITE(11,'(A)') '    namelen = LEN(dset_name)'
        WRITE(11,'(A)') '    errcode = h5ltmake_dataset_c(loc_id,namelen,dset_name,rank,dims,H5T_NATIVE_DOUBLE,f_ptr)'
        WRITE(11,'(A)') '  END SUBROUTINE h5ltmake_dataset_double_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     ENDDO
  ENDDO

! h5ltread_dataset_double_f
  DO i = 1, num_rkinds
     k = rkind(i)
     WRITE(chr2,'(I2)') k
     DO j = 1, 8

! DLL definitions for windows
        WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
        WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltread_dataset_double_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
        WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
        WRITE(11,'(A)') '  SUBROUTINE h5ltread_dataset_double_kind_'//TRIM(ADJUSTL(chr2))&
             &//'_rank'//chr_rank(j)//'(loc_id,dset_name,buf,dims,errcode)'
        WRITE(11,'(A)') '    IMPLICIT NONE'
        WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
        WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
        WRITE(11,'(A)') '    INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
        WRITE(11,'(A)') '    REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
        WRITE(11,'(A)') '    INTEGER :: errcode '
        WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'
        WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'

        WRITE(11,'(A)') f_ptr_line(j)
        WRITE(11,'(A)') '    namelen = LEN(dset_name)'
        WRITE(11,'(A)') '    errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr)'
        WRITE(11,'(A)') '  END SUBROUTINE h5ltread_dataset_double_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     ENDDO
  ENDDO

! h5ltmake_dataset_f
  DO i = 1, num_ikinds
     k = ikind(i)
     WRITE(chr2,'(I2)') k
     DO j = 1, 8

! DLL definitions for windows
        WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
        WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltmake_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
        WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
        WRITE(11,'(A)') '  SUBROUTINE h5ltmake_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))&
             &//'_rank'//chr_rank(j)//'(loc_id,dset_name,rank,dims,type_id,buf,errcode)'
        WRITE(11,'(A)') '    IMPLICIT NONE'
        WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
        WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
        WRITE(11,'(A)') '    INTEGER,          INTENT(IN) :: rank'
        WRITE(11,'(A)') '    INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
        WRITE(11,'(A)') '    INTEGER(hid_t),   INTENT(in) :: type_id'
        WRITE(11,'(A)') '    INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
        WRITE(11,'(A)') '    INTEGER :: errcode '
        WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'
        WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'

        WRITE(11,'(A)') f_ptr_line(j)
        WRITE(11,'(A)') '    namelen = LEN(dset_name)'
        WRITE(11,'(A)') '    errcode = h5ltmake_dataset_c(loc_id, namelen, dset_name, rank, dims, type_id, f_ptr)'
        WRITE(11,'(A)') '  END SUBROUTINE h5ltmake_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     ENDDO
  ENDDO

! h5ltmake_dataset_int_f
  DO i = 1, num_ikinds
     k = ikind(i)
     WRITE(chr2,'(I2)') k
     DO j = 1, 8

! DLL definitions for windows
        WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
        WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltmake_dataset_int_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
        WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
        WRITE(11,'(A)') '  SUBROUTINE h5ltmake_dataset_int_kind_'//TRIM(ADJUSTL(chr2))&
             &//'_rank'//chr_rank(j)//'(loc_id,dset_name,rank,dims,buf,errcode)'
        WRITE(11,'(A)') '    IMPLICIT NONE'
        WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
        WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
        WRITE(11,'(A)') '    INTEGER,          INTENT(IN) :: rank'
        WRITE(11,'(A)') '    INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
        WRITE(11,'(A)') '    INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
        WRITE(11,'(A)') '    INTEGER :: errcode '
        WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'
        WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'
        WRITE(11,'(A)') '    INTEGER(hid_t) :: type_id'

        WRITE(11,'(A)') f_ptr_line(j)
        WRITE(11,'(A)') '    namelen = LEN(dset_name)'
        WRITE(11,'(A)') '    type_id = h5kind_to_type(KIND('//f_ptr_line(j)(19:36)//'), H5_INTEGER_KIND)'
        WRITE(11,'(A)') '    errcode = h5ltmake_dataset_c(loc_id, namelen, dset_name, rank, dims, type_id, f_ptr)'
        WRITE(11,'(A)') '  END SUBROUTINE h5ltmake_dataset_int_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     ENDDO
  ENDDO

! h5ltread_dataset_f
  DO i = 1, num_ikinds
     k = ikind(i)
     WRITE(chr2,'(I2)') k
     DO j = 1, 8

! DLL definitions for windows
        WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
        WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltread_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
        WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
        WRITE(11,'(A)') '  SUBROUTINE h5ltread_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))&
             &//'_rank'//chr_rank(j)//'(loc_id,dset_name, type_id, buf,dims,errcode)'
        WRITE(11,'(A)') '    IMPLICIT NONE'
        WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
        WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
        WRITE(11,'(A)') '    INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
        WRITE(11,'(A)') '    INTEGER(hid_t),   INTENT(in) :: type_id'
        WRITE(11,'(A)') '    INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
        WRITE(11,'(A)') '    INTEGER :: errcode '
        WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'
        WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'

        WRITE(11,'(A)') f_ptr_line(j)
        WRITE(11,'(A)') '    namelen = LEN(dset_name)'
        WRITE(11,'(A)') '    errcode = h5ltread_dataset_c(loc_id, namelen, dset_name, type_id, f_ptr)'
        WRITE(11,'(A)') '  END SUBROUTINE h5ltread_dataset_integer_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     ENDDO
  ENDDO

! h5ltread_dataset_int_f
  DO i = 1, num_ikinds
     k = ikind(i)
     WRITE(chr2,'(I2)') k
     DO j = 1, 8

! DLL definitions for windows
        WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
        WRITE(11,'(A)') '!DEC$attributes dllexport :: h5ltread_dataset_int_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
        WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
        WRITE(11,'(A)') '  SUBROUTINE h5ltread_dataset_int_kind_'//TRIM(ADJUSTL(chr2))&
             &//'_rank'//chr_rank(j)//'(loc_id,dset_name, buf,dims,errcode)'
        WRITE(11,'(A)') '    IMPLICIT NONE'
        WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
        WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
        WRITE(11,'(A)') '    INTEGER(hsize_t), DIMENSION(*), INTENT(in) :: dims'
        WRITE(11,'(A)') '    INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf'
        WRITE(11,'(A)') '    INTEGER :: errcode '
        WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'
        WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'
        WRITE(11,'(A)') '    INTEGER(hid_t) :: type_id'

        WRITE(11,'(A)') f_ptr_line(j)
        WRITE(11,'(A)') '    namelen = LEN(dset_name)'
        WRITE(11,'(A)') '    type_id = h5kind_to_type(KIND('//f_ptr_line(j)(19:36)//'), H5_INTEGER_KIND)'
        WRITE(11,'(A)') '    errcode = h5ltread_dataset_c(loc_id, namelen, dset_name, type_id, f_ptr)'
        WRITE(11,'(A)') '  END SUBROUTINE h5ltread_dataset_int_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     ENDDO
  ENDDO

  WRITE(11,'(A)') 'END MODULE H5LT' ! change this to be generic MSB

  CLOSE(11)

! Generate Fortran H5TB* interfaces having multiple KIND interfaces.


  OPEN(11,FILE='H5TBff_gen.F90')
  WRITE(11,'(40(A,/))') &
'!****h* ROBODoc/H5TBff_gen.F90',&
'!',&
'! NAME',&
'!  H5TBff_gen',&
'! ',&
'! PURPOSE',&
'!  This module is generated at build by H5HL_buildiface.F90 to handle all the',&
'!  detected REAL/INTEGER KINDs for APIs being passed those KINDs. Currently these ',&
'!  are H5LT and H5TB APIs',&
'!',&
'! COPYRIGHT',&
'! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *',&
'!   Copyright by The HDF Group.                                               *',&
'!   All rights reserved.                                                      *',&
'!                                                                             *',&
'!   This file is part of HDF5.  The full HDF5 copyright notice, including     *',&
'!   terms governing use, modification, and redistribution, is contained in    *',&
'!   the COPYING file, which can be found at the root of the source code       *',&
'!   distribution tree, or in https://www.hdfgroup.org/licenses.               *',&
'!   If you do not have access to either file, you may request a copy from     *',&
'!   help@hdfgroup.org.                                                        *',&
'! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *',&
'!',&
'! AUTHOR',&
'!   H5HL_buildiface.F90',&
'!',&
'!*****'

  WRITE(11,'(a)') "MODULE H5TB"

  WRITE(11,'(A)') '  USE, INTRINSIC :: ISO_C_BINDING'
  WRITE(11,'(A)') '  USE h5fortran_types'
  WRITE(11,'(A)') '  USE H5TB_CONST'
  WRITE(11,'(A)') '  IMPLICIT NONE'

!***************
! H5TB INTERFACES
!***************

!  h5tbwrite_field_name_f
  WRITE(11,'(A)') "  INTERFACE h5tbwrite_field_name_f"
  DO i = 1, num_rkinds
     j = rkind(i)
     WRITE(chr2,'(I2)') j
     k =2
     WRITE(11,'(A)') "     MODULE PROCEDURE h5tbwrite_field_name_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

!  h5tbread_field_name_f
  WRITE(11,'(A)') "  INTERFACE h5tbread_field_name_f"
  DO i = 1, num_rkinds
     j = rkind(i)
     WRITE(chr2,'(I2)') j
     k = 2
     WRITE(11,'(A)') "     MODULE PROCEDURE h5tbread_field_name_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

!  h5tbwrite_field_index_f
  WRITE(11,'(A)') "  INTERFACE h5tbwrite_field_index_f"
  DO i = 1, num_rkinds
     j = rkind(i)
     WRITE(chr2,'(I2)') j
     k = 2
     WRITE(11,'(A)') "     MODULE PROCEDURE h5tbwrite_field_index_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

!  h5tbread_field_index_f
  WRITE(11,'(A)') "  INTERFACE h5tbread_field_index_f"
  DO i = 1, num_rkinds
     j = rkind(i)
     WRITE(chr2,'(I2)') j
     k = 2
     WRITE(11,'(A)') "     MODULE PROCEDURE h5tbread_field_index_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

!  h5tbinsert_field_f
  WRITE(11,'(A)') "  INTERFACE h5tbinsert_field_f"
  DO i = 1, num_rkinds
     j = rkind(i)
     WRITE(chr2,'(I2)') j
     k = 2
     WRITE(11,'(A)') "     MODULE PROCEDURE h5tbinsert_field_kind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
  END DO
  WRITE(11,'(A)') "  END INTERFACE"

  WRITE(11,'(A)') 'CONTAINS'

  !**********************
  ! H5TB APIs
  !**********************

  ! h5tbwrite_field_name_f
  DO i = 1, num_rkinds
     k = rkind(i)
     WRITE(chr2,'(I2)') k
     j = 2
! DLL definitions for windows
     WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
     WRITE(11,'(A)') '!DEC$attributes dllexport :: h5tbwrite_field_name_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
     WRITE(11,'(A)') '  SUBROUTINE h5tbwrite_field_name_kind_'//TRIM(ADJUSTL(chr2))&
          &//'_rank'//chr_rank(j)//'(loc_id,dset_name,field_name,start, nrecords,type_size,buf,errcode)'
     WRITE(11,'(A)') '    IMPLICIT NONE'
     WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
     WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
     WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(in) :: field_name'
     WRITE(11,'(A)') '    INTEGER(hsize_t), INTENT(in) :: start'
     WRITE(11,'(A)') '    INTEGER(hsize_t), INTENT(in) :: nrecords'
     WRITE(11,'(A)') '    INTEGER(size_t),  INTENT(in) :: type_size'
     WRITE(11,'(A)') '    REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf'
     WRITE(11,'(A)') '    INTEGER :: errcode '
     WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'
     WRITE(11,'(A)') '    INTEGER(size_t) :: namelen1'
     WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'

     WRITE(11,'(A)') f_ptr_line(j)
     WRITE(11,'(A)') '    namelen = LEN(dset_name)'
     WRITE(11,'(A)') '    namelen1 = LEN(field_name)'
     WRITE(11,'(A)') &
          '    errcode = h5tbwrite_field_name_c(loc_id,namelen,dset_name,namelen1,field_name,start,nrecords,type_size,f_ptr)'
     WRITE(11,'(A)') '  END SUBROUTINE h5tbwrite_field_name_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
  ENDDO

  ! h5tbread_field_name_f
  DO i = 1, num_rkinds
     k = rkind(i)
     WRITE(chr2,'(I2)') k
     j = 2
! DLL definitions for windows
     WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
     WRITE(11,'(A)') '!DEC$attributes dllexport :: h5tbread_field_name_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
     WRITE(11,'(A)') '  SUBROUTINE h5tbread_field_name_kind_'//TRIM(ADJUSTL(chr2))&
          &//'_rank'//chr_rank(j)//'(loc_id,dset_name,field_name,start, nrecords,type_size,buf,errcode)'
     WRITE(11,'(A)') '    IMPLICIT NONE'
     WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
     WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
     WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(in) :: field_name'
     WRITE(11,'(A)') '    INTEGER(hsize_t), INTENT(in) :: start'
     WRITE(11,'(A)') '    INTEGER(hsize_t), INTENT(in) :: nrecords'
     WRITE(11,'(A)') '    INTEGER(size_t),  INTENT(in) :: type_size'
     WRITE(11,'(A)') '    REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT), DIMENSION(*), TARGET :: buf'
     WRITE(11,'(A)') '    INTEGER :: errcode '
     WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'
     WRITE(11,'(A)') '    INTEGER(size_t) :: namelen1'
     WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'

     WRITE(11,'(A)') f_ptr_line(j)
     WRITE(11,'(A)') '    namelen = LEN(dset_name)'
     WRITE(11,'(A)') '    namelen1 = LEN(field_name)'
     WRITE(11,'(A)') &
          '    errcode = h5tbread_field_name_c(loc_id,namelen,dset_name,namelen1,field_name,start,nrecords,type_size,f_ptr)'
     WRITE(11,'(A)') '  END SUBROUTINE h5tbread_field_name_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
  ENDDO

  ! h5tbwrite_field_index_f
  DO i = 1, num_rkinds
     k = rkind(i)
     WRITE(chr2,'(I2)') k
     j = 2
! DLL definitions for windows
     WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
     WRITE(11,'(A)') '!DEC$attributes dllexport :: h5tbwrite_field_index_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
     WRITE(11,'(A)') '  SUBROUTINE h5tbwrite_field_index_kind_'//TRIM(ADJUSTL(chr2))&
          &//'_rank'//chr_rank(j)//'(loc_id,dset_name,field_index,start, nrecords,type_size,buf,errcode)'
     WRITE(11,'(A)') '    IMPLICIT NONE'
     WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
     WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
     WRITE(11,'(A)') '    INTEGER, INTENT(in) :: field_index'
     WRITE(11,'(A)') '    INTEGER(hsize_t), INTENT(in) :: start'
     WRITE(11,'(A)') '    INTEGER(hsize_t), INTENT(in) :: nrecords'
     WRITE(11,'(A)') '    INTEGER(size_t),  INTENT(in) :: type_size'
     WRITE(11,'(A)') '    REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN), DIMENSION(*), TARGET :: buf'
     WRITE(11,'(A)') '    INTEGER :: errcode '
     WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'
     WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'

     WRITE(11,'(A)') f_ptr_line(j)
     WRITE(11,'(A)') '    namelen = LEN(dset_name)'
     WRITE(11,'(A)') &
          '    errcode = h5tbwrite_field_index_c(loc_id,namelen,dset_name,field_index,start,nrecords,type_size,f_ptr)'
     WRITE(11,'(A)') '  END SUBROUTINE h5tbwrite_field_index_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
  ENDDO

  ! h5tbread_field_index_f
  DO i = 1, num_rkinds
     k = rkind(i)
     WRITE(chr2,'(I2)') k
     j = 2
! DLL definitions for windows
     WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
     WRITE(11,'(A)') '!DEC$attributes dllexport :: h5tbread_field_index_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
     WRITE(11,'(A)') '  SUBROUTINE h5tbread_field_index_kind_'//TRIM(ADJUSTL(chr2))&
          &//'_rank'//chr_rank(j)//'(loc_id,dset_name,field_index,start, nrecords,type_size,buf,errcode)'
     WRITE(11,'(A)') '    IMPLICIT NONE'
     WRITE(11,'(A)') '    INTEGER(hid_t)  , INTENT(IN) :: loc_id'
     WRITE(11,'(A)') '    CHARACTER(LEN=*), INTENT(IN) :: dset_name'
     WRITE(11,'(A)') '    INTEGER, INTENT(in) :: field_index'
     WRITE(11,'(A)') '    INTEGER(hsize_t), INTENT(in) :: start'
     WRITE(11,'(A)') '    INTEGER(hsize_t), INTENT(in) :: nrecords'
     WRITE(11,'(A)') '    INTEGER(size_t),  INTENT(in) :: type_size'
     WRITE(11,'(A)') '    REAL(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT), DIMENSION(*), TARGET :: buf'
     WRITE(11,'(A)') '    INTEGER :: errcode '
     WRITE(11,'(A)') '    INTEGER(size_t) :: namelen'
     WRITE(11,'(A)') '    TYPE(C_PTR) :: f_ptr'

     WRITE(11,'(A)') f_ptr_line(j)
     WRITE(11,'(A)') '    namelen = LEN(dset_name)'
     WRITE(11,'(A)') &
          '    errcode = h5tbread_field_index_c(loc_id,namelen,dset_name,field_index,start,nrecords,type_size,f_ptr)'
     WRITE(11,'(A)') '  END SUBROUTINE h5tbread_field_index_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
  ENDDO

  ! h5tbinsert_field_f
  DO i = 1, num_rkinds
     k = rkind(i)
     WRITE(chr2,'(I2)') k
     j = 2
! DLL definitions for windows
     WRITE(11,'(A)') '!DEC$if defined(BUILD_HDF5_HL_DLL)'
     WRITE(11,'(A)') '!DEC$attributes dllexport :: h5tbinsert_field_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
     WRITE(11,'(A)') '!DEC$endif'

! Subroutine API
     WRITE(11,'(A)') '  SUBROUTINE h5tbinsert_field_kind_'//TRIM(ADJUSTL(chr2))&
          &//'_rank'//chr_rank(j)//'(loc_id,dset_name,field_name,field_type,field_index,buf,errcode)'
     WRITE(11,'(A)') '    IMPLICIT NONE'
     WRITE(11,'(A)') '        INTEGER(hid_t),   INTENT(in) :: loc_id'
     WRITE(11,'(A)') '        CHARACTER(LEN=*), INTENT(in) :: dset_name'
     WRITE(11,'(A)') '        CHARACTER(LEN=*), INTENT(in) :: field_name'
     WRITE(11,'(A)') '        INTEGER(hid_t), INTENT(in)   :: field_type'
     WRITE(11,'(A)') '        INTEGER, INTENT(in) :: field_index'
     WRITE(11,'(A)') '        REAL(KIND='//TRIM(ADJUSTL(chr2))//'), INTENT(IN), DIMENSION(*), TARGET :: buf'
     WRITE(11,'(A)') '        INTEGER(size_t) :: namelen'
     WRITE(11,'(A)') '        INTEGER(size_t) :: namelen1'
     WRITE(11,'(A)') '        INTEGER :: errcode'
     WRITE(11,'(A)') '        TYPE(C_PTR) :: f_ptr'

     WRITE(11,'(A)') f_ptr_line(j)
     WRITE(11,'(A)') '    namelen = LEN(dset_name)'
     WRITE(11,'(A)') '    namelen1 = LEN(field_name)'
     WRITE(11,'(A)') &
          '    errcode = h5tbinsert_field_c(loc_id,namelen,dset_name,namelen1,field_name,field_type,field_index,f_ptr)'
     WRITE(11,'(A)') '  END SUBROUTINE h5tbinsert_field_kind_'//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(j)
  ENDDO

  WRITE(11,'(A)') 'END MODULE H5TB'

  CLOSE(11)

END PROGRAM H5HL_buildiface