Alex Fenton
8/29/2007 11:37:00 AM
zdk wrote:
> If I have swig module
>
> %module example
> on2sc Flix2_CreateEx (FLIX2HANDLE *pFlix, const char *rpchost,
> int32_t timeout)
>
> How can I pass argument as a pointer in Ruby? ( I mean the
> "FLIX2HANDLE" type)
>
> require 'example'
> h = Example.Flix2_CreateEx(....<how?>...,"localhost",0)
SWIG is able to handle pointers without any particular help. But if you
need to be able to pass a FLIX2HANDLE (whatever that is) as an argument,
then you need to wrap that in Ruby as well, using SWIG, so a Ruby object
can be linked to a FLIX2HANDLE.
You might have a look at the SQLite3 SWIG wrapper. The SQLite3 C API
makes extensive use of a db handle as a first argument, but the Ruby API
makes a nice job of hiding this from the user.
Alex