Hello

How can i compile my module by MSVC++ 6.0?

When i try compile source from Programming Ruby book, i get error:

Compiling...
tstruby.cpp
d:\tstruby\tstruby.cpp(25) : error C2664: 'rb_define_method' : cannot
convert parameter 3 from 'unsigned long (unsigned long)' to 'unsigned long
(__cdecl *)(...)'
        None of the functions with this name in scope match the target type
d:\tstruby\tstruby.cpp(26) : error C2664: 'rb_define_method' : cannot
convert parameter 3 from 'unsigned long (unsigned long,unsigned long)' to
'unsigned long (__cdecl *)(...)'
        None of the functions with this name in scope match the target type
Error executing cl.exe.

tstruby.dll - 2 error(s), 0 warning(s)

Configuration:

Ruby: ruby-1.6.7-i586-mswin32

Project settings: Win32 Dynamic-Link Library

/nologo /MTd /W3 /Gm /GX /ZI /Od /I
"D:\ruby-1.6.7-mswin\lib\ruby\1.6\i586-mswin32" /D "WIN32" /D "_DEBUG" /D
"_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TSTRUBY_EXPORTS"
/Fp"Debug/tstruby.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ  /c

Source:

#include "ruby.h"

static VALUE t_init(VALUE self)
{
  VALUE arr;

  arr = rb_ary_new();
  rb_iv_set(self, "@arr", arr);
  return self;
}

static VALUE t_add(VALUE self, VALUE anObject)
{
  VALUE arr;

  arr = rb_iv_get(self, "@arr");
  rb_ary_push(arr, anObject);
  return arr;
}

VALUE cTest;

void Init_Test() {
  cTest = rb_define_class("Test", rb_cObject);
  rb_define_method(cTest, "initialize", t_init, 0);
  rb_define_method(cTest, "add", t_add, 1);
}


Anton Kondakov