At Fri, 20 Jul 2007 06:14:48 -0700,
Henric Jungheim wrote:
> I'm trying to implement a standard gsl_rng_type that is
> backed by a file.  The file should be opened when the
> gsl_rng is created, a clone needs to dup() the file handle
> and copy the file offset, and the file needs to be closed
> when gsl_rng_free() is called.

Hello, 

Thanks for your email.  There is no simple way to do that in GSL.  The
way I would recommend is to define an extended type/object in your own
code which includes a gsl_rng object in its struct.  The extended type
should have its own custom alloc/free functions, not use the gsl rng
alloc functions.

At the point where you want a plain gsl rng, extract it from the
extended type with a function defined to do that:

     rngx * rx = rngx_alloc(Tx, file, ...)
     gsl_rng * r = rngx_extract(rx);

-- 
Brian Gough
(GSL Maintainer)

Network Theory Ltd,
Publishing the GSL Manual - http://www.network-theory.co.uk/gsl/manual/


_______________________________________________
Help-gsl mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gsl

Reply via email to