Hello Neil, > I guess it may be GC. I've had problems with code like > > (procedure->pointer void (lambda (...) ...) args...) > > because procedure->pointer does not protect the (lambda ...) from being GC'd. > > For example: > http://git.savannah.nongnu.org/cgit/ossaulib.git/commit/?id=1d31a87b53e9375b5fdd5120b7d409e6dde6aa47 > > I wonder if there's a similar problem here with the string->pointer data.
Thanks for your help! Following your explanation and example, I tried this and thought it would work then, but it also failed: GNU Guile 2.2.4.1-cdb19 Copyright (C) 1995-2017 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> ,use (system foreign) scheme@(guile-user)> (define str-1 "Hello") scheme@(guile-user)> (define str-2 "there!") scheme@(guile-user)> (make-c-struct (list '* '*) (list (string->pointer str-1) (string->pointer str-2))) $2 = #<pointer 0x55ae02e57830> scheme@(guile-user)> (parse-c-struct $2 (list '* '*)) $3 = (#<pointer 0x55ae02f9e3c0> #<pointer 0x55ae02f8b050>) scheme@(guile-user)> (map pointer->string $3) $4 = ("" "`\v?\x02?U") Cheers, David
pgplxh7jYl0VB.pgp
Description: OpenPGP digital signature