[Gambas-user] pigpio c library callback gives segmentation fault (11)
Steve
stevjensen at aol.com
Tue Nov 13 01:10:11 CET 2018
I turned the pigipod_if2.c function set into a shared library that
Gambas3 found acceptable for use with Extern statement.
In general the functions work fine. The connected hardware is accessed
and properly manipulated.
However one of the functions needs a callback. When the callback is
triggered a segmentation fault occurs. Generally this means to me that
the address being passed is invalid and an attempt was made to go
outside user space.
The gambas documentation says it should work. Is there something special
I need to do?
tia
Code below
Library "/home/pi/Desktop/PigpioLib/libpigpiod_if2"
Extern callback(aPi As Integer, user_gpio As Integer, int_edge As
Integer, func As Pointer) As Integer
Public sub main_load
iGpio_CB_Left = callback(iPi, 23, 0, Callback_Left)
End
Public sub callback_left(igpio as integer, istate as integer, itick as
integer)
...
End
[System]
Gambas=3.9.1
OperatingSystem=Linux
Kernel=4.14.50-v7+
Architecture=armDistribution=debian 9.4
Desktop=LXDE
Theme=Qt5CTProxy
Language=en_US.UTF-8
Memory=927M
[Libraries]
Cairo=libcairo.so.2.11400.8
Curl=libcurl.so.4.4.0
DBus=libdbus-1.so.3.14.15
GStreamer=libgstreamer-0.10.so.0.30.0
GStreamer=libgstreamer-1.0.so.0.1004.0
GTK+2=libgtk-x11-2.0.so.0.2400.31
GTK+3=libgtk-3.so.0.2200.11
OpenGL=libGL.so.1.2.0
Poppler=libpoppler.so.64.0.0
QT5=libQt5Core.so.5.7.1
SDL=libSDL-1.2.so.0.11.4
SQLite=libsqlite3.so.0.8.6
[Environment]
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
DESKTOP_SESSION=LXDE-<user>
DISPLAY=:0.0
GB_GUI=gb.qt5
GDMSESSION=lightdm-xsession
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
HOME=<home>
INFINALITY_FT_AUTOHINT_HORIZONTAL_STEM_DARKEN_STRENGTH=10
INFINALITY_FT_AUTOHINT_INCREASE_GLYPH_HEIGHTS=true
INFINALITY_FT_AUTOHINT_SNAP_STEM_HEIGHT=100
INFINALITY_FT_AUTOHINT_VERTICAL_STEM_DARKEN_STRENGTH=25
INFINALITY_FT_BOLD_EMBOLDEN_X_VALUE=0
INFINALITY_FT_BOLD_EMBOLDEN_Y_VALUE=0
INFINALITY_FT_BRIGHTNESS=0
INFINALITY_FT_CHROMEOS_STYLE_SHARPENING_STRENGTH=0
INFINALITY_FT_CONTRAST=0
INFINALITY_FT_FILTER_PARAMS=11 22 38 22 11
INFINALITY_FT_FRINGE_FILTER_STRENGTH=0
INFINALITY_FT_GAMMA_CORRECTION=0 100
INFINALITY_FT_GLOBAL_EMBOLDEN_X_VALUE=0
INFINALITY_FT_GLOBAL_EMBOLDEN_Y_VALUE=0
INFINALITY_FT_GRAYSCALE_FILTER_STRENGTH=0
INFINALITY_FT_STEM_ALIGNMENT_STRENGTH=25
INFINALITY_FT_STEM_FITTING_STRENGTH=25
INFINALITY_FT_STEM_SNAPPING_SLIDING_SCALE=40
INFINALITY_FT_USE_KNOWN_SETTINGS_ON_SELECTED_FONTS=true
INFINALITY_FT_USE_VARIOUS_TWEAKS=true
INFINALITY_FT_WINDOWS_STYLE_SHARPENING_STRENGTH=10
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LOGNAME=<user>
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
PWD=<home>
QT_QPA_PLATFORMTHEME=qt5ct
SAL_USE_VCLPLUGIN=gtk
SHELL=/bin/bash
SSH_AGENT_PID=614
SSH_AUTH_SOCK=/tmp/ssh-oBISTq0a0BrD/agent.489
TEXTDOMAIN=Linux-PAM
TZ=:/etc/localtime
USER=<user>
XAUTHORITY=<home>/.Xauthority
XDG_CONFIG_DIRS=/etc/xdg
XDG_CONFIG_HOME=<home>/.config
XDG_CURRENT_DESKTOP=LXDE
XDG_DATA_DIRS=/usr/local/share:/usr/share/ras<user>-ui-overrides:/usr/share:/usr/share/gdm:/var/lib/menu-xdg
XDG_GREETER_DATA_DIR=/var/lib/lightdm/data/<user>
XDG_MENU_PREFIX=lxde-<user>-
XDG_RUNTIME_DIR=/run/user/1000
XDG_SEAT=seat0
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_DESKTOP=lightdm-xsession
XDG_SESSION_ID=c1
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SESSION_TYPE=x11
XDG_VTNR=7
_LXSESSION_PID=489
More information about the User
mailing list