summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/winapi.f90
blob: 0ee3920ff947944c43642229e07db12109312228 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
! { dg-do run { target *-*-cygwin* *-*-mingw* } }
! { dg-options "-lkernel32" }
! Test case provided by Dennis Wassel.

PROGRAM winapi

  USE, INTRINSIC :: iso_c_binding
  IMPLICIT NONE

  INTERFACE
     ! Specifically select the lstrlenA version for ASCII.
     FUNCTION lstrlen(string) BIND(C, name = "lstrlenA")
       USE, INTRINSIC :: iso_c_binding
       IMPLICIT NONE
       !GCC$ ATTRIBUTES STDCALL :: lstrlen
       INTEGER (C_INT)          :: lstrlen
       CHARACTER(KIND=C_CHAR), INTENT(in) :: string(*)
     END FUNCTION lstrlen
  END INTERFACE
  
  IF (lstrlen(C_CHAR_"winapi"//C_NULL_CHAR) /= 6) CALL abort()

END PROGRAM winapi