设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
楼主: yangff
打印 上一主题 下一主题

[有事请教] Ruby1.9.2怎么在MSVC++里面运行?

[复制链接]

Lv2.观梦者

傻♂逼

梦石
0
星屑
374
在线时间
1606 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

11
 楼主| 发表于 2011-9-23 23:28:02 | 只看该作者
本帖最后由 yangff 于 2011-9-23 23:31 编辑
苏小脉 发表于 2011-9-23 23:26
什么叫 “API 形式”?难道你还不在 Ruby 里用 Gem?Gem 一般都只是导出了一个 Init_* 入口点,其余函数 ...


Rm的dll是完整的msvcr*-ruby???.dll无误
还有
#ifndef RUBY_LIB_PREFIX
#include "ruby/config.h"
#ifdef RUBY_EXTCONF_H
#include RUBY_EXTCONF_H
#endif
这是ruby/ruby.h里面的,这个config文件不存在,何解?

点评

ps:装两个Ruby1.9.2怎么分开gem……  发表于 2011-9-23 23:28
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

神仙

梦石
0
星屑
69
在线时间
596 小时
注册时间
2007-5-14
帖子
1289
12
发表于 2011-9-23 23:52:52 | 只看该作者
两位敢交换QQ私聊而不刷帖嘛?
回复 支持 反对

使用道具 举报

Lv2.观梦者

傻♂逼

梦石
0
星屑
374
在线时间
1606 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

13
 楼主| 发表于 2011-9-23 23:55:23 | 只看该作者
还有……用Ruby.h的时候
  1.         38        IntelliSense: cannot overload functions distinguished by return type alone        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h        2059        1       
  2.         39        IntelliSense: cannot overload functions distinguished by return type alone        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h        2081        1       
  3.         41        IntelliSense: cannot overload functions distinguished by return type alone        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h        2118        1       
  4.         42        IntelliSense: cannot overload functions distinguished by return type alone        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h        2138        1       
  5.         43        IntelliSense: cannot overload functions distinguished by return type alone        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h        2158        1       
  6.         44        IntelliSense: cannot overload functions distinguished by return type alone        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\winsock2.h        2176        1       
  7.         4        IntelliSense: expected an identifier        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h        390        5       
  8.         5        IntelliSense: expected an identifier        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h        391        5       
  9.         6        IntelliSense: expected an identifier        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h        392        5       
  10.         7        IntelliSense: expected an identifier        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h        399        5       
  11.         8        IntelliSense: expected an identifier        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h        405        5       
  12.         9        IntelliSense: expected an identifier        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h        406        5       
  13.         10        IntelliSense: expected an identifier        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h        407        5       
  14.         11        IntelliSense: expected an identifier        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h        423        5       
  15.         12        IntelliSense: expected an identifier        c:\program files (x86)\microsoft sdks\windows\v7.0a\include\ws2def.h        433        5       
复制代码

点评

纠结难道只能用夏娜那个了……这什么奇怪的错误啊…  发表于 2011-9-23 23:58
一坨,跟一坨一样50多条  发表于 2011-9-23 23:55
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
120
在线时间
953 小时
注册时间
2007-4-25
帖子
805
14
发表于 2011-9-24 00:03:37 | 只看该作者
yangff 发表于 2011-9-23 23:28
Rm的dll是完整的msvcr*-ruby???.dll无误
还有
#ifndef RUBY_LIB_PREFIX

你查看一下 RGSS????.dll 的导出表就知道了,除了几个正则表达式引擎的抽象接口之外,就只剩下 RM 的高层接口了。如下:

    ordinal hint RVA      name

          1    0 0011F71C EncDefaultCharEncoding
          2    1 00003E00 RGSSAddRTPPath
          3    2 00003B70 RGSSAudioFinalize
          4    3 00003B10 RGSSAudioInitialize
          5    4 00003E10 RGSSClearRTPPath
          6    5 00003CE0 RGSSErrorMessage
          7    6 00003CC0 RGSSErrorType
          8    7 00003C10 RGSSEval
          9    8 00003B00 RGSSFinalize
         10    9 00003E20 RGSSGC
         11    A 00003B90 RGSSGameMain
         12    B 00003C30 RGSSGetBool
         13    C 00003EC0 RGSSGetDouble
         14    D 00003E30 RGSSGetInt
         15    E 00003D10 RGSSGetPathWithRTP
         16    F 00003DF0 RGSSGetRTPPath
         17   10 00003F90 RGSSGetStringACP
         18   11 00003F30 RGSSGetStringUTF8
         19   12 00003C60 RGSSGetTable
         20   13 00003AF0 RGSSInitialize
         21   14 000040B0 RGSSSetString
         22   15 000041F0 RGSSSetStringACP
         23   16 00004150 RGSSSetStringUTF8
         24   17 00004320 RGSSSetupRTP
         25   18 0011F150 RegDefaultSyntax
         26   19 0011F5D8 RegEncodingASCII
         27   1A 00121020 RegEncodingEUC_JP
         28   1B 00121168 RegEncodingSJIS
         29   1C 00120ED8 RegEncodingUTF8
         30   1D 0011F140 RegSyntaxRuby
         31   1E 00064900 enc_get_left_adjust_char_head
         32   1F 00064860 enc_get_prev_char_head
         33   20 000647E0 enc_get_right_adjust_char_head
         34   21 0006F030 re_alloc_pattern
         35   22 00063BC0 regex_end
         36   23 00064E30 regex_error_code_to_str
         37   24 0005EB10 regex_foreach_name
         38   25 00063AB0 regex_free
         39   26 00064790 regex_get_encoding
         40   27 000647A0 regex_get_options
         41   28 000647B0 regex_get_syntax
         42   29 0006A900 regex_init
         43   2A 0006D450 regex_match
         44   2B 0005EBD0 regex_name_to_backref_number
         45   2C 0005EB80 regex_name_to_group_numbers
         46   2D 0006EF70 regex_new
         47   2E 0005EB60 regex_number_of_names
         48   2F 0006F050 regex_recompile
         49   30 00063CD0 regex_region_clear
         50   31 00063F10 regex_region_copy
         51   32 00063EC0 regex_region_free
         52   33 00063EB0 regex_region_new
         53   34 00063D10 regex_region_resize
         54   35 0006D920 regex_search
         55   36 0005E6D0 regex_set_verb_warn_func
         56   37 0005E6C0 regex_set_warn_func
         57   38 000647C0 regex_version
         58   39 000649B0 ruby_re_adjust_startpos
         59   3A 0006EFE0 ruby_re_compile_pattern
         60   3B 00064A00 ruby_re_free_pattern
         61   3C 000649A0 ruby_re_free_registers
         62   3D 0006DF30 ruby_re_match
         63   3E 00064A20 ruby_re_mbcinit
         64   3F 0006F0B0 ruby_re_recompile_pattern
         65   40 0006DF60 ruby_re_search
         66   41 00064A10 ruby_re_set_casetable

大量的 Ruby API 都没有导出。之前夏娜那个使得 require so 库成为可能的工程,实际上就是通过反汇编给这个 DLL 打的补丁,把 Ruby 原有的 API 重新导出。

这个config文件不存在,何解?

config.h 是 GNU 的 autoconf 自动生成的配置文件。在类 Un*x 环境下,./config 就是 autoconf 工具链的入口点执行脚本,该脚本会根据当前系统环境生成 config.h 及 Makefile,之后用户便可以通过 gmake 等工具进行 build。我之前建议的是,不理会 autoconf,直接提取你需要的宏、类型声明、函数原型,但如果遇到如下般的根据 autoconf 配置的环境而变化的定义:

  1. #if defined?(_WIN32)
  2. # ...
  3. #elsif defined?(_POSIX_VERSION)
  4. # ...
  5. #end
复制代码
或是:

  1. #if defined?(HAS_LONG_LONG)
  2. # ...
  3. #end

  4. #if defined?(HAS_UINTPTR)
  5. # ...
  6. #end
复制代码
则直接选择符合你环境的定义。你在 Win32 环境,故选择 _WIN32 分歧下的定义;你用 VS2010,支持 uintptr_t,故选择 HAS_UINTPTR 分歧下的定义。

装两个Ruby1.9.2怎么分开gem……

Ruby 目录下有专门放 Ruby 扩展的子目录。
[email protected]:~> repeat 1 fortune
Matz is nice, so we are nice.
回复 支持 反对

使用道具 举报

Lv2.观梦者

傻♂逼

梦石
0
星屑
374
在线时间
1606 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

15
 楼主| 发表于 2011-9-24 00:09:58 | 只看该作者
苏小脉 发表于 2011-9-24 00:03
你查看一下 RGSS????.dll 的导出表就知道了,除了几个正则表达式引擎的抽象接口之外,就只剩下 RM 的高层 ...

那那一坨乱七八糟的错误是咋回事……

点评

RGE好像没有改什么啊……  发表于 2011-9-24 00:38
另外为什么我的Rm的导出表有100多个东西……  发表于 2011-9-24 00:10
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
120
在线时间
953 小时
注册时间
2007-4-25
帖子
805
16
发表于 2011-9-24 01:39:52 | 只看该作者
yangff 发表于 2011-9-24 00:09
那那一坨乱七八糟的错误是咋回事……

在你当前的编译单元中有相同签名但返回类型不同的函数声明,这多半是命名冲突的问题。ruby.h 中的名字污染相当严重。这也是为什么我建议从中提取需要的。

另外为什么我的Rm的导出表有100多个东西……  

可能是版本差异,但横竖 Ruby 的 API 绝不止"100多个"。

RGE好像没有改什么啊……

本来也没什么要改的,RGE 只是提取,兼容。
[email protected]:~> repeat 1 fortune
Matz is nice, so we are nice.
回复 支持 反对

使用道具 举报

Lv2.观梦者

傻♂逼

梦石
0
星屑
374
在线时间
1606 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

17
 楼主| 发表于 2011-9-24 01:52:10 | 只看该作者
苏小脉 发表于 2011-9-24 01:39
在你当前的编译单元中有相同签名但返回类型不同的函数声明,这多半是命名冲突的问题。ruby.h 中的名字污 ...

可是Ruby的include里面根本没有include winsock2.h……我也没引用……吧……难道windows.h自带??
RGE也没看到提取什么吧……
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
120
在线时间
953 小时
注册时间
2007-4-25
帖子
805
18
发表于 2011-9-24 02:38:29 | 只看该作者
yangff 发表于 2011-9-24 01:52
可是Ruby的include里面根本没有include winsock2.h……我也没引用……吧……难道windows.h自带??
RGE也 ...

ruby.h 没有引用,不代表 ruby.h 引用的 *.h 没有引用。

RGE也没看到提取什么吧……

看来最后还是非得把文件名一一给你耳。
Common/RubyDefineV186.h
Common/RubyDefineV191.h
Common/RubyDefineVXXX.h
Common/IRgeRubyAbstractLayer.h
RgeCore/Source/RubyAbstractLayer.h
RgeCore/Source/RubyAbstractLayer.cpp
[email protected]:~> repeat 1 fortune
Matz is nice, so we are nice.
回复 支持 反对

使用道具 举报

Lv2.观梦者

傻♂逼

梦石
0
星屑
374
在线时间
1606 小时
注册时间
2007-3-13
帖子
6562

烫烫烫开拓者

19
 楼主| 发表于 2011-9-24 10:03:46 | 只看该作者
本帖最后由 yangff 于 2011-9-24 10:12 编辑
苏小脉 发表于 2011-9-24 02:38
ruby.h 没有引用,不代表 ruby.h 引用的 *.h 没有引用。


http://ondineyuga.com/svn/RGE2/RubyGameEngine2nd/Common/
http://ondineyuga.com/svn/RGE2/RubyGameEngine2nd/RGE2Core/Source/
http://ondineyuga.com/svn/RGE2/R ... y-1.9.1/ruby/ruby.h
http://ondineyuga.com/svn/RGE2/R ... re/Source/Entry.cpp
  1. #include "ruby.h"
  2. #include "RgeSystem.h"
复制代码
这并没有什么不同啊……难道1.9.1可以,1.9.2就不行?
哎呀,蛋疼什么的最有爱了
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
120
在线时间
953 小时
注册时间
2007-4-25
帖子
805
20
发表于 2011-9-24 10:24:30 | 只看该作者
yangff 发表于 2011-9-24 10:03
http://ondineyuga.com/svn/RGE2/RubyGameEngine2nd/Common/
http://ondineyuga.com/svn/RGE2/RubyGameEn ...

这个不是 RGE2 的主 repo,我没试过,请你看 RGE2 的主干:
/[2011-05-01]Rge2nd
[email protected]:~> repeat 1 fortune
Matz is nice, so we are nice.
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-7-20 08:49

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表