Skip to content

Instantly share code, notes, and snippets.

@microhobby
Created October 6, 2022 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save microhobby/2e0221e8c6e677d505d183c59064508a to your computer and use it in GitHub Desktop.
Save microhobby/2e0221e8c6e677d505d183c59064508a to your computer and use it in GitHub Desktop.
Testing getting errno with Gambas3
#include <stdio.h>
#include <gpiod.h>
#include <errno.h>
int main(int argc, char *argv[])
{
struct gpiod_chip *chip;
int ret;
chip = gpiod_chip_open_by_number(0);
ret = errno;
printf("Errno :: %d\n", ret);
if (!chip) {
return ret;
}
return 0;
}
' Gambas module file
Library "libgpiod:2"
Extern gpiod_version_string() As String In "libgpiod:2"
Extern gpiod_chip_open_by_number(chip As Integer) As Pointer In "libgpiod:2"
Public Sub Main()
Dim chip As Pointer
Dim ret As Integer
chip = gpiod_chip_open_by_number(0)
ret = System.Error
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