IRC channel logs


back to list of logs

*daviid fixed and fine tuned guile-gnome make distcheck
<nalaginrut>morning guilers~
***michel_mno_afk is now known as michel_mno
<amirouche>paroneayea: pong
***ft_ is now known as ft
***petercom1and is now known as petercommand
<ajnirp>hopefully not off-topic: i get permission-denied errors when trying a member clone from ssh://
<ajnirp>i've followed the instructions at and i don't know what i'm doing wrong
<ajnirp>do i need to add myself to ?
<dsmith-work>Monday Greetings, Guilers
***michel_mno is now known as michel_mno_afk
<please_help>how do I put a bunch of struct* into a c-array to pass it along via the ffi? I tried using pointer-address on the * and putting that into a 'u64 array, then passing it with bytevector->pointer but that doesn't work apparently.
<ajnirp>sorry for proposing a different solution, but do you have any control over the struct members?
<ajnirp>please_help: if yes, then one possibility is to turn the struct into an intrusive linked list
<ajnirp>i very recently wrote some ffi code for working with getifaddrs(), which returns a struct ifaddrs*, which in turn has a field that points to either NULL or the next struct ifaddrs
<ajnirp>using an intrusive linked list would mean no worrying about arrays
<please_help>ajnirp: if I had any control over the struct members, I wouldn't have to make a list of structs to begin with.
<ajnirp>ah ok
*ajnirp goes back to work
<please_help>there's a way to dereference a pointer to pointer, but I suppose there's no way to do the reverse on the scheme side?
<ijp>you mean turn an address into a pointer?
<please_help>no, I mean get a pointer to an address of a pointer
<ijp>pointers don't have addresses, they are addresses
<ijp>but obviously we are talking about pointer objects, so I'll skip the pedantry
<please_help>of course pointers can have addresses
<please_help>arr x[4]; x[0] = &x
<please_help>or perhaps int* x = (int*)malloc(sizeof(int*)*4); *x = &x;?
<ijp>it is a pointer to a location that contains a pointer
<ijp>pointers themselves are immediate objects
<ijp>not that it matters
<ijp>your initial solution sounded right to me, I'm not sure why that wouldn't work properly
<ijp>wait u64, hmm, do bytevector procedures work on those
<please_help>as far as I can tell they do
<ijp>the array situation is rather messy, and I refuse to maintain it in my head for longer than is necessary
<ijp>please_help: do you have a code sample?
<ijp>minimal examples for mixed code is kinda difficult, I know, but whatever you can give
<please_help>(hopefully I didn't mess up this trivial C function, at least I know the real C function is fine)
<ijp>okay, I suspect the problem there is that you are using numbers
<please_help>what's wrong with numbers?
<ijp>you'd think scm->pointer would error for immediates
<please_help>I like numbers.
<please_help>let me try another version
<ijp>no hold on, I want to play some more
<please_help>you were right
<please_help>if I set the numbers in an array and then use (pointer-address (bytevector->pointer arr2 offset)) it works
<ijp>that would be better anyway, I think, since you don't need to depend on guiles representation of integers
<please_help>but that doesn't solve the real problem, I have the pointer to the structs via make-c-struct but I need to make that into an array of pointers and pass it...
<ijp>I know it's hard to tell from a blank irc channel, but I am looking into it
<ijp> worked just fine for me
<ijp>I think the problem in your last paste is just the type of fn
<ijp>i.e. it should be numbers** instead of numbers*
<please_help>oops, right
<please_help>so the real function is struct_t* typed, therefore I need to someone assemble the struct array in contiguous memory rather than make a list of their pointer addresses
<please_help>but make-c-struct makes a pointer to the struct_t ...
<ijp>I don't know of a good way to do this with the officially exported procedures, *but* there is a write-c-struct in (system foreign) that would be better for this
<ijp>you will be able to access it via (@@ (system foreign) write-c-struct)
<ijp>the definition of make-c-struct should explain how to use it:
<ijp>(define (make-c-struct types vals) (let ((bv (make-bytevector (sizeof types) 0))) (write-c-struct bv 0 types vals) (bytevector->pointer bv)))
<please_help>other than that, cheating by handpacking the data in an array works.
<paroneayea>read a civodul presentation, bumped into HOP
<paroneayea>wrong link
<paroneayea>wonder why I hadn't heard of it before