# Ruby Swig passing Argument

**URL:** <https://www.ruby-forum.com/t/ruby-swig-passing-argument/113074>\
**Category:** Ruby\
**Created:** [August 27, 2007, 9:16am UTC](https://www.ruby-forum.com/t/ruby-swig-passing-argument/113074 "2007-08-27T09:16:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![zdk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/9d8465/32.png) [@zdk](https://www.ruby-forum.com/u/zdk)\
**Post date:** [August 27, 2007, 9:16am UTC](https://www.ruby-forum.com/t/ruby-swig-passing-argument/113074/1 "2007-08-27T09:16:43Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![zdk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/9d8465/32.png) [@zdk](https://www.ruby-forum.com/u/zdk)\
**Post date:** [August 29, 2007, 1:41pm UTC](https://www.ruby-forum.com/t/ruby-swig-passing-argument/113074/2 "2007-08-29T13:41:13Z")

</div>

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
