Skip to content

Instantly share code, notes, and snippets.

@microhobby
Created October 6, 2022 15:16
Show Gist options
  • Save microhobby/245022469ffbcea1a07a7579839d90a2 to your computer and use it in GitHub Desktop.
Save microhobby/245022469ffbcea1a07a7579839d90a2 to your computer and use it in GitHub Desktop.
' Gambas module file
Library "libgpiod:2"
Library "libc:6"
Extern gpiod_version_string() As String In "libgpiod:2"
Extern gpiod_chip_open_by_number(chip As Integer) As Pointer In "libgpiod:2"
Extern __errno_location() As Pointer In "libc:6"
Public Sub Main()
Dim chip As Pointer
Dim ret As Integer
Dim errno As Pointer = __errno_location()
chip = gpiod_chip_open_by_number(0)
ret = Int@(errno)
Print "Errno :: " & ret
If IsNull(chip) Then
Quit ret
Endif
Quit 0
End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment