Ruby Swig passing Argument

Hi Folks,
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)

Any help or suggestion would be greatly appreciated.

Thank you very much.

Warachet S.

zdk wrote:

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs