Amirouche Boubekki <amirou...@hypermove.net> writes: > On 2016-05-31 21:29, taylanbayi...@gmail.com wrote: >> scheme@(guile-user)> (define testfunc >> (bs:pointer->proc >> foo_t ;return value type >> (dynamic-func "testfunc" (dynamic-link >> "libtest")) >> (list foo_t))) ;list of argument types > > Why don't you use dynamic-link* signature like described in [1]: > > ((dynamic-link* [library-name]) return-type function-name . arguments) > > [1] http://www.hyperdev.fr/notes/gnu-guile-ffi.html
Hmm, if one wishes, one can wrap bs:pointer->proc in a similar fashion; I'll leave that up to the users of the library. :-) >> scheme@(guile-user)> (define foo2 (testfunc foo)) > > isn't foo2 `equal?' to foo? I'm not sure how you mean exactly. Firstly, foo and foo2 are separate record instances, so they wouldn't be equal? even if they contained the same values in the same fields (using equal? on record objects falls back to using eqv?), but they also contain different values in their fields, since foo2 is the one returned by 'testfunc'. (Also remember that structs are passed by-value in C, so testfunc receives a *copy* of foo as its argument when it's called, which it then modifies and returns.) Hope that helps! Taylan