Ruby Swig passing Argument

Z

zdk

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.
 
A

Alex Fenton

zdk said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top