On Wed, Feb 26, 2014 at 4:12 AM, Danek Duvall <[email protected]> wrote:

> I've been trying to get dynamic ruby support working on Solaris, with a
> 64-bit build of vim 7.4.192 and Ruby 1.9.  I was getting a pair of link
> errors about rb_fix2int and rb_num2int, and in the course of poking around
> found that the following patch seems to work:
>
>     --- src/if_ruby.c.orig  Tue Feb 25 10:14:41 2014
>     +++ src/if_ruby.c       Tue Feb 25 10:14:45 2014
>     @@ -88,7 +88,7 @@
>      # define rb_int2big rb_int2big_stub
>      #endif
>
>     -#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 \
>     +#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 \
>             && VIM_SIZEOF_INT < VIM_SIZEOF_LONG
>      /* Ruby 2.0 defines a number of static functions which use rb_fix2int
> and
>       * rb_num2int if VIM_SIZEOF_INT < VIM_SIZEOF_LONG (64bit) */
>     @@ -392,7 +392,7 @@
>      {
>          return dll_rb_int2big(x);
>      }
>     -#  if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 \
>     +#  if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 19 \
>             && VIM_SIZEOF_INT < VIM_SIZEOF_LONG
>      long rb_fix2int_stub(VALUE x)
>      {
>
> I don't know whether that's right or not, though, though our ruby.h
> definitely uses rb_fix2int() and rb_num2int() in macros, which is what it
> sounds like the comment suggests happened in 2.0.
>
> I do get the following warnings, though:
>
>     "if_ruby.c", line 206: warning: macro redefined: rb_fix2int
>     "if_ruby.c", line 207: warning: macro redefined: rb_num2int
>
> which isn't surprising, since fist they're #defined to the stub versions,
> and here they're #defined to the dll_ versions.
>
> Simple ruby tests work, so it's not all broken, but I don't know enough
> Ruby to test these two functions to see if what I've done is completely
> busted.
>
> Any help would be appreciated.


I think your patch is right.
With ruby2, I get same warnings without patch.
Maybe it is better to use stub version always for simplicity.

diff -r 10d35c8b50e3 src/if_ruby.c
--- a/src/if_ruby.c    Mon Feb 24 03:32:00 2014 +0100
+++ b/src/if_ruby.c    Thu Feb 27 02:31:03 2014 +0900
@@ -88,8 +88,7 @@
 # define rb_int2big rb_int2big_stub
 #endif

-#if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 \
-    && VIM_SIZEOF_INT < VIM_SIZEOF_LONG
+#if defined(DYNAMIC_RUBY_VER) && VIM_SIZEOF_INT < VIM_SIZEOF_LONG
 /* Ruby 2.0 defines a number of static functions which use rb_fix2int and
  * rb_num2int if VIM_SIZEOF_INT < VIM_SIZEOF_LONG (64bit) */
 # define rb_fix2int rb_fix2int_stub
@@ -203,8 +202,6 @@
 # define rb_inspect            dll_rb_inspect
 # define rb_int2inum            dll_rb_int2inum
 # if VIM_SIZEOF_INT < VIM_SIZEOF_LONG /* 64 bits only */
-#  define rb_fix2int            dll_rb_fix2int
-#  define rb_num2int            dll_rb_num2int
 #  define rb_num2uint            dll_rb_num2uint
 # endif
 # define rb_lastline_get            dll_rb_lastline_get
@@ -392,8 +389,7 @@
 {
     return dll_rb_int2big(x);
 }
-#  if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 20 \
-    && VIM_SIZEOF_INT < VIM_SIZEOF_LONG
+#  if defined(DYNAMIC_RUBY_VER) && VIM_SIZEOF_INT < VIM_SIZEOF_LONG
 long rb_fix2int_stub(VALUE x)
 {
     return dll_rb_fix2int(x);


-- 
Yukihiro Nakadaira - [email protected]

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Raspunde prin e-mail lui