I checked again. and The patch may not have every compiler.

> That sounds like a problem in the Ruby include file.
> The system must define off_t, not the library.

Of course, I think so.

> Is there an #ifdef around this define of off_t?

Yes, but it is awkward.
I get the distribution archive from following URL:

ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/
  ruby-1.9.2-p0-i386-mswin32.zip

This include windows binary and header files.
-----------------
|+ include
|  ruby.h
|  + i386-msvcrt
|    + ruby
|         config.h
|  + ruby
|    ruby.h
|    win32.h
-----------------

1. 'ruby/win32.h' define 'off_t'.

    #if SIZEOF_OFF_T == 8
    #define off_t __int64
    ...

2. And 'i386-msvcrt/ruby/config.h' define 'SIZEOF_OFF_T'.

    #define SIZEOF_OFF_T 8

   this macro don't block any #ifdef

> Is that why including sys/types.h first helps?
> If we include this patch there at least needs to be a comment exlaining why 
> it's needed.

Some compiler don't fix this problem. I tested MSVC.
We may have to re-define off_t .

-------------------------

#include <ruby.h>
#ifdef RUBY19_OR_LATER
# include <ruby/encoding.h>
#endif

#undef off_t
typedef long off_t; // perhaps, this will be same as it in other
sources.

-------------------------
But too tricky... :(


Thanks.
- Yasuhiro Matsumoto


On Oct 8, 8:38 pm, Bram Moolenaar <[email protected]> wrote:
> Yasuhiro Matsumoto wrote:
> > I found a cause of crash.
>
> > This is happend on windows only.
> > Distribution of ruby-win32 include a header file 'ruby/win32.h' that
> > has some defines of types(ex: off_t).
> > And my distribution's one is: #define off_t __int64 (8byte). But
> > MSVC's one is 'typedef long off_t;' (4byte) .
> > Thus, it make problem that offsetof(buf_T,b_ruby_ref) in 'if_ruby.c'
> > is different from other's offsetof(buf_T,if_ruby_ref) .
>
> > I wrote a patch for this problem. Please check and include.
> > It works fine for me. :)
>
> > Everyone: please check this in other OS.
>
> That sounds like a problem in the Ruby include file.  The system must
> define off_t, not the library.  Is there an #ifdef around this define of
> off_t?  Is that why including sys/types.h first helps?
>
> If we include this patch there at least needs to be a comment exlaining
> why it's needed.
>
> --
> hundred-and-one symptoms of being an internet addict:
> 245. You use Real Audio to listen to a radio station from a distant
>      city rather than turn on your stereo system.
>
>  /// Bram Moolenaar -- [email protected] --http://www.Moolenaar.net  \\\
> ///        sponsor Vim, vote for features --http://www.Vim.org/sponsor/\\\
> \\\        download, build and distribute --http://www.A-A-P.org       ///
>  \\\            help me help AIDS victims --http://ICCF-Holland.org   ///

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

Raspunde prin e-mail lui