Re: FFI and miniPicolisp

2008-09-08 Thread Tomas Hlavaty
Hi Simon, > where a function allocates a new struct, and returns a pointer, which > is then used as the first argument to all functions. that should work. epi:new_RNG returns a pointer which is represented as an integer number in PicoLisp. When you pass this integer to epi:RNG_next_double, it g

Re: FFI and miniPicolisp

2008-09-03 Thread Simon Frost
Dear Tomas, Tomas Hlavaty wrote: the functions should be "exposed", if you try (setq r (epi:w_RNG 1)), because that's how you specified the name transformation with the module function. The second arg to module says how the C function names are turned into picolisp function names. By default,

Re: FFI and miniPicolisp

2008-09-03 Thread Tomas Hlavaty
Hi Simon, > (cfun RNG* new_RNG (ulong seed)) > (cfun double RNG_next_double (RNG* self)) > {cfun_new_RNG, "epi:w_RNG"}, > {cfun_RNG_next_double, "epi:G_next_double"}, > > Everything links fine, but are these functions automatically exposed? > Are there any tips so I can do things like > > (set

FFI and miniPicolisp

2008-09-02 Thread Simon Frost
Hi Folks, I've been trying out FFI using Tomas Hlavaty's ffi.l wrapper. All goes well in terms of generating wrappers, but I don't know how to call the functions from picolisp: Here's my ffi file: (load "ffi.l") (module 'epi '((X) (pack "epi:" (cddr (chop X) (include "epidemic.h") (put '