Skip to content

Commit 8d9eb44

Browse files
committed
Update unsigned type import.
1 parent ee88aca commit 8d9eb44

File tree

3 files changed

+32
-13
lines changed

3 files changed

+32
-13
lines changed

src/sqlite3.F90

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55
! Author: Philipp Engel
66
! Licence: ISC
77
module sqlite3
8-
use, intrinsic :: iso_c_binding
8+
use, intrinsic :: iso_c_binding, only: c_associated, c_funloc, &
9+
c_char, c_double, c_int, c_int64_t, c_size_t, &
10+
c_funptr, c_ptr, c_null_char, c_null_funptr, c_null_ptr
11+
#if HAS_UNSIGNED
12+
13+
use, intrinsic :: iso_c_binding, only: c_unsigned
14+
15+
#endif
916
use :: sqlite3_util
1017
implicit none (type, external)
1118
private
1219

13-
#if defined (__flang__) || (defined (__GFORTRAN__) && __GNUC__ > 15) || (defined (__GFORTRAN__) && __GNUC__ == 15 && __GNUC_MINOR__ >= 2)
20+
#if HAS_UNSIGNED
1421

1522
public :: c_unsigned
1623

@@ -20,6 +27,20 @@ module sqlite3
2027

2128
#endif
2229

30+
public :: c_associated
31+
public :: c_funloc
32+
33+
public :: c_char
34+
public :: c_double
35+
public :: c_int
36+
public :: c_int64_t
37+
public :: c_size_t
38+
public :: c_funptr
39+
public :: c_ptr
40+
public :: c_null_char
41+
public :: c_null_funptr
42+
public :: c_null_ptr
43+
2344
integer(kind=c_int), parameter, public :: SQLITE_INTEGER = 1
2445
integer(kind=c_int), parameter, public :: SQLITE_FLOAT = 2
2546
integer(kind=c_int), parameter, public :: SQLITE_TEXT = 3

src/sqlite3_util.f90

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,6 @@ module sqlite3_util
1010
implicit none (type, external)
1111
private
1212

13-
interface
14-
function c_strlen(str) bind(c, name='strlen')
15-
import :: c_ptr, c_size_t
16-
implicit none
17-
type(c_ptr), intent(in), value :: str
18-
integer(kind=c_size_t) :: c_strlen
19-
end function c_strlen
20-
end interface
21-
2213
public :: c_f_str_ptr
2314
contains
2415
subroutine c_f_str_ptr(c_str, f_str)
@@ -29,6 +20,15 @@ subroutine c_f_str_ptr(c_str, f_str)
2920
character(kind=c_char), pointer :: ptrs(:)
3021
integer(kind=c_size_t) :: i, sz
3122

23+
interface
24+
function c_strlen(str) bind(c, name='strlen')
25+
import :: c_ptr, c_size_t
26+
implicit none
27+
type(c_ptr), intent(in), value :: str
28+
integer(kind=c_size_t) :: c_strlen
29+
end function c_strlen
30+
end interface
31+
3232
copy_block: block
3333
if (.not. c_associated(c_str)) exit copy_block
3434
sz = c_strlen(c_str)

test/test_sqlite3.f90

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
! test_sqlite3.f90
22
module callbacks
3-
use, intrinsic :: iso_c_binding
43
use :: sqlite3
54
use :: sqlite3_util
65
implicit none
@@ -88,7 +87,6 @@ end subroutine update_callback
8887
end module callbacks
8988

9089
program test_sqlite3
91-
use, intrinsic :: iso_c_binding
9290
use :: sqlite3
9391
use :: callbacks
9492
implicit none (type, external)

0 commit comments

Comments
 (0)