IRC channel logs
2017-08-27.log
back to list of logs
<stratotanker>Can someone help me with guile foreign structs? I'll describe a struct containing a field of struct type, is this supported? <amz3`>stratotanker: yes, it supported via scheme-bytestructures? <amz3`>stratotanker: are you using guix? <amz3`>stratotanker: you need to install the above ^ scheme-bytestructures <cmaloney>ACTION saves you all the half-hour slowly-scrolling-sinewave of seizure-inducing-text <amz3``>mwette: ffi helper runtime it quiet slow to compile <amz3``>its the bindings that are taking time actually <mwette>once compiled it should be fine. There is a LOT of code to compile. <mwette>if you are compiling the libgit2 file <mwette>libgit2.scm is 15000 lines, so probably at least 5 k lines of code <mwette>I get compile time of libgit2 with guile22 4m44s and with guile20 1m7s. <mwette>OTOH `guild22 compile -O0 libgit2.scm' takes 51s. <amz3``>I desactivated auto compilation for the time being <amz3``>mwette: I get the following error: libgit2/raw.scm:477:0: libgit2/raw.scm:477:0: Unbound variable: wrap-git_transfer_progress_cb <amz3``>raw.scm is the libgit2.scm file you gave me I renamed it <amz3``>when I look at the definition of git_transfer_progress_cb I see there is a random number at the end of the definition, something like the following: wrap-git_transfer_progress_cb-63bd61d526e9f <stratotanker>Hello, more help within guile and FFI please. I have a C function that returns a dynamically allocated string (char*). I don't know how to free this string. I'm thinking about make a foreign pointer to free and call it passing the string. I'ts right or there is a better way? <mwette>hmm, something amiss. I get the undefined wrap also for guile22. I need to add the function wrappers. You could define that as identity for now. <mwette>I don't know what the random number is: looks like an address. <mwette>stratotanker: I don't know that one. Maybe you can make an ffi for free() and pass it the pointer <stratotanker>mwette thanks for reply, I'll put a tag and continue, maybe there is a better clean way to do this :) <amz3``>mwette: what the difference between /p and other macros? <amz3``>it also defines pointer descriptors <amz3``>there is something wrong with 'define-fh-function' macro <mwette>(define-syntax define-fh-function <mwette> (symbol->string (syntax->datum stx))) <mwette> (define (gen-id tmpl-id . args) <mwette> (with-syntax ((desc (gen-id x #'name "-desc")) <mwette>I have also added this to the libgit2.scm: <mwette>(define void intptr_t) ;; no void in bytestructures <amz3``>the problem is with 'export' and 'syntax-case' thing <amz3``>I will try to make a small example <mwette>I get the unbound wrap-git_transfer_progress_cb <mwette>but not for any other function typedefs. so odd <amz3``>now I have another behavior... seems like define-syntax doesn't behave correctly in front of 'export' <mwette>Now if I swap decl's of git_transfer_progress_cb and git_transport_message_cb I get error that wrap-git_transport_message_cb is undefined. <amz3``>I will paste the result of the macro expander on that expression <amz3``>I changed a little the definition of define-fh-function to use define-public, the problem is the same <amz3``>e.g. it define the following 'git_transfer_progress_cb-desc-11a3102235694990' and then try to export 'git_transfer_progress_cb-desc' <mwette>Maybe my use of #'( (aka (syntax ) and the defined "desc" is not right. <amz3``>I think there is an issue between 'wrap' syntax defined in `define-fh-function/p` and the `wrap` syntax defined in `define-fh-function` without the p <amz3``>when you use define-fh-function alone it works <amz3``>mergin both macro into a single macro solve the issue <amz3``>I got a bunch a undefined symbols due to the fact that I use an old-ish libgit2 and things compiled fully <janneke>a mescc-built tinycc: mes-tcc just compiled its first working executable <happy_gnu[m]>We play each week a different game at a different time so every time zone can join <amz3``>mwette: I tested basic stuff and it seems to work <amz3``>mwette: I am not sure yet what to do with the procedure generated with define-fh-compound <mwette>bytestructures allows you to get/set structure field values <mwette>you can make a structure with (make-foo_t <values>) where values is bytevector (there may be other choices -- can't look now) <stratotanker>hello, I'd like to debug an error in a script. I tried to run guile with --debug but nothing happen, also using (debug) at the beginning of the wrong code does not help, please someone can help? <stratotanker>manumanumanu, sorry I'm pretty new to scheme, I didn't try this, please wait a sec... <manumanumanu>from the repl you can try it with different inputs to try to narrow down what the problem might be <manumanumanu>stratotanker: I am probably not the right person to help though, since I do (display)-driven debugging <stratotanker>I got: wrong-type-arg (#f Wrong type to apply: ~S (0) (0)) <manumanumanu>stratotanker: and you are sure that is where things break? <stratotanker>but, apart from this case, there is a debug mode in guile? like gdb? Remember, I'm pretty new and this maybe a stupid question :\\ <manumanumanu>Most people debug in the repl. You can inspect the continuations and bound variables and such <manumanumanu>anyway, that error seems to imply that something is #f and you are trying to use it as a procedure <manumanumanu>and btw: (while (not (eq? iterator #f)) is the same as (while iterator <stratotanker>It's gnu fdisk, I'm restarting from scratch using scheme <rekado>davexunit: do you know if there’s a usable guile-yaml library?