IRC channel logs
2022-04-13.log
back to list of logs
<ekaitz>hi! how can I generate a foreign-function for `openpty`? It's part of libc but I'm unable to find it <mwette>ekaitz: if you get nyacc there's a termios FFI module, then make new pty.ffi with this (and compile): (define-ffi-module (ffi pty) #:include '("pty.h") #:use-ffi-module (ffi termios)) <ekaitz>mwette: thanks! so there's no way to do it directly like this? (foreign-library-function #f "tcgetattr") <mwette>sure. I'll post something close ... <ekaitz>i'm trying to do it but it doesn't find, but it can find tcgetattr and stuff like that, for instance <mwette>(foreign-library-function #f "openpty" int (list '* '* '* '* '*)) I think <mwette>er (foreign-library-function #f "openpty" #:return-type int #:arg-types (list '* '* '* '* '*)) <ekaitz>yeah, i tried that but it doesn't work <ekaitz>In procedure dlsym: Error resolving "openpty": "guile: undefined symbol: openpty" <ekaitz>but it does work for other functions <mwette>I get $1 = #<procedure 7f90d98bd100 (_ _ _ _ _)> <ekaitz>so your system finds it and mine doesnt... <mwette>maybe your OS does not have it? (or not in libc) <ekaitz>i tried to make a c file including `pty.h` and run cpp on top of it <ekaitz>and it generates a file with openpty <mwette>you need to compile "gcc file.c" to see if it finds the object in libc <ekaitz>oh correct! it doesn't find openpty <ekaitz>it must be defined in another library because python's openpty does work <ekaitz>anyway mwette thank you for your help, this is something I need to look up further with guix people <ekaitz>I just found it's part of a separate sublibrary -lutil <amazigh>I did a PR a while back against guile-fibers <amazigh>fwiw they are nasty bugs looming and that is not FUD