Re: make-c-struct and pointer->string

2019-04-02 Thread David Pirotte
Hello Mark, > >> 'make-c-struct' copies the C pointers from those foreign pointer objects, > >> but > >> not not keep a reference to the objects themselves. > > To me, this sounds very counter intuitive, actually, it sounds like a bug, > > make-c-struct should be holding a reference to the po

Re: make-c-struct and pointer->string

2019-04-01 Thread Mark H Weaver
Hi David, David Pirotte writes: >> 'make-c-struct' copies the C pointers from those foreign pointer objects, >> but not >> not keep a reference to the objects themselves. > > To me, this sounds very counter intuitive, actually, it sounds like a bug, > make-c-struct should be holding a referenc

Re: make-c-struct and pointer->string

2019-03-31 Thread Mark H Weaver
Hi David, David Pirotte writes: >> 'make-c-struct' copies the C pointers from those foreign pointer objects, >> but not >> not keep a reference to the objects themselves. > > To me, this sounds very counter intuitive, actually, it sounds like a bug, > make-c-struct should be holding a referenc

Re: make-c-struct and pointer->string

2019-03-31 Thread David Pirotte
Hi Mark, Thanks for your help. > > ... > > scheme@(guile-user)> (make-c-struct (list '* '*) (list (string->pointer > > "hello > > ") (string->pointer "there!"))) $16 = # > > scheme@(guile-user)> (parse-c-struct $16 (list '* '*)) > > $17 = (# #) > > scheme@(guile-user)> (map pointer->string $17)

Re: make-c-struct and pointer->string

2019-03-30 Thread Mark H Weaver
Hi David, David Pirotte writes: > Hello, > > guile 2.2.4.1-cdb19 > > ,use (system foreign) > > ;; this fails > > scheme@(guile-user)> (make-c-struct (list '* '*) (list (string->pointer > "hello ") (string->pointer "there!"))) > $16 = # > scheme@(guile-user)> (parse-c-struct $16 (list '* '

Re: make-c-struct and pointer->string

2019-03-29 Thread Neil Jerram
On Fri, 29 Mar 2019, 09:46 David Pirotte, wrote: > Hi again, > > > ... > > 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 > > > Enter `,help' for help. > > scheme@(guile-user)> ,use (system foreign) > >

Re: make-c-struct and pointer->string

2019-03-29 Thread David Pirotte
Hi again, > ... > 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 > Enter `,help' for help. > scheme@(guile-user)> ,use (system foreign) > scheme@(guile-user)> (define str-1 "Hello") > scheme@(guile-user)> (def

Re: make-c-struct and pointer->string

2019-03-29 Thread David Pirotte
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=1d31

Re: make-c-struct and pointer->string

2019-03-28 Thread Neil Jerram
On Thu, 28 Mar 2019 at 15:15, Amirouche Boubekki wrote: > > Eventually, I can reproduced the issue with guile-next from guix: > > scheme@(guile-user) [1]> (make-c-struct (list '* '*) (list (string->pointer > "hello ") (string->pointer "there!"))) > $5 = # > scheme@(guile-user) [1]> (parse-c-struc

Re: make-c-struct and pointer->string

2019-03-28 Thread David Pirotte
Hi Amirouche, I should add to your own answer that you actually were unable to reproduce the problem while using the latest 2.2 release tarball (the one that Ubuntu packages to be (even) more precise), as one can see on your gnome paste earlier today [1] So, if this is corect, there must be a co

Re: make-c-struct and pointer->string

2019-03-28 Thread Amirouche Boubekki
Eventually, I can reproduced the issue with guile-next from guix: scheme@(guile-user) [1]> (make-c-struct (list '* '*) (list (string->pointer "hello ") (string->pointer "there!"))) $5 = # scheme@(guile-user) [1]> (parse-c-struct $5 (list '* '*)) $6 = (# #) scheme@(guile-user) [1]> (map pointer->st

make-c-struct and pointer->string

2019-03-26 Thread David Pirotte
Hello, guile 2.2.4.1-cdb19 ,use (system foreign) ;; this fails scheme@(guile-user)> (make-c-struct (list '* '*) (list (string->pointer "hello ") (string->pointer "there!"))) $16 = # scheme@(guile-user)> (parse-c-struct $16 (list '* '*)) $17 = (# #) scheme@(guile-user)> (map pointer->st