Hello everyone,

I need to get the parameters info (at least the number of arguments) of the methods of a library I made in C++, and has been wrapped with SWIG for Ruby.

The problem is that when I run the command from Ruby (arity() in this case), it returns that the method has a variable number of arguments. Here's an example:

library.h: (in C++)
class Date
{
private:
    int m_nMonth;
    int m_nDay;
    int m_nYear;
public:
    Date(int nMonth, int nDay, int nYear);
 
    void SetDate(int nMonth, int nDay, int nYear);
 
    int GetMonth() { return m_nMonth; }
    int GetDay()  { return m_nDay; }
    int GetYear() { return m_nYear; }
};

library.cpp: (in C++)
class Date
{
private:
    int m_nMonth;
    int m_nDay;
    int m_nYear;
 
    Date() { }
 
public:
    Date(int nMonth, int nDay, int nYear);
 
    void SetDate(int nMonth, int nDay, int nYear);
 
    int GetMonth() { return m_nMonth; }
    int GetDay()  { return m_nDay; }
    int GetYear() { return m_nYear; }
};

Date::Date(int nMonth, int nDay, int nYear)
{
    SetDate(nMonth, nDay, nYear);
}

void Date::SetDate(int nMonth, int nDay, int nYear)
{
    m_nMonth = nMonth;
    m_nDay = nDay;
    m_nYear = nYear;
}

library.i: (SWIG interface)
%module libreria
%{
#include "libreria.h"
%}
%include "libreria.h"

RUBY code:
## check number of arguments in constructor (initialize in ruby)
Library::Date.method(:initialize).arity ## returns -1 (means variable) and should return 3

Does anyone has an idea on how to aproach this??

Thank you!
--
Mariano