查看: 2495|回复: 1

[已经解决] so文件的问题

[复制链接]
梦石
1
星屑
644
在线时间
277 小时
注册时间
2008-3-30
回帖
65

R考场第七期铜奖

发表于 2010-8-30 11:16:00 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
我想在游戏里require一个so库(opengl),可是总是出问题:
  1. #
  2. # Copyright (C) 2006 Peter McLain <peter.mclain@gmail.com>
  3. # Copyright (C) 2007 Jan Dvorak <jan.dvorak@kraxnet.cz>
  4. #
  5. # This program is distributed under the terms of the MIT license.
  6. # See the included MIT-LICENSE file for the terms of this license.
  7. #
  8. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  9. # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  10. # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  11. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  12. # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  13. # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  14. # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  15. #

  16. # This module provides access to the GL,GLU and GLUT methods and constants
  17. # in the way that they were available in previous versions of ruby-opengl.
  18. #
  19. # Thanks to Ilmari Heikkinen for a previous "reversed" version of this code,
  20. # and to Bill Kelly for a version before that one.

  21. temp = Dir.getwd
  22. $:.push(temp)
  23. require 'gl.so'
  24. require 'glu.so'
  25. require 'glut.so'

  26. include Gl,Glu,Glut

  27. # (Gl.)glVertex -> GL.Vertex
  28. # (Gl::)GL_TRUE -> GL::TRUE
  29. module GL
  30.         extend self
  31.         include Gl
  32.        
  33.         Gl.constants.each do |cn|
  34.                 n = cn.to_s.sub(/^GL_/,'')
  35.                 # due to ruby naming scheme, we can't export constants with leading decimal,
  36.                 # e.g. (Gl::)GL_2D would under old syntax become (GL::)2D which is illegal
  37.                 next if n =~ /^[0-9]/
  38.                 const_set( n, Gl.const_get( cn ) )
  39.         end
  40.        
  41.         Gl.methods( false ).each do |mn|
  42.                 n = mn.to_s.sub(/^gl/,'')
  43.                 alias_method( n, mn )
  44.                 public( n )
  45.         end
  46. end

  47. # (Glu.)gluSphere -> GLU.Sphere
  48. # (Glu::)GLU_INSIDE -> GLU::INSIDE
  49. module GLU
  50.         extend self
  51.         include Glu
  52.        
  53.         Glu.constants.each do |cn|
  54.                 n = cn.to_s.sub(/^GLU_/,'')
  55.                 const_set( n, Glu.const_get( cn ) )
  56.         end
  57.        
  58.         Glu.methods( false ).each do |mn|
  59.                 n = mn.to_s.sub(/^glu/,'')
  60.                 alias_method( n, mn )
  61.                 public( n )
  62.         end
  63. end

  64. # (Glut.)glutInit -> GLUT.Init
  65. # (Glut::)GLUT_RGBA -> GLUT::RGBA
  66. module GLUT
  67.         extend self
  68.         include Glut
  69.        
  70.         Glut.constants.each do |cn|
  71.                 n = cn.to_s.sub(/^GLUT_/,'')
  72.                 const_set( n, Glut.const_get( cn ) )
  73.         end
  74.        
  75.         Glut.methods( false ).each do |mn|
  76.                 n = mn.to_s.sub(/^glut/,'')
  77.                 alias_method( n, mn )
  78.                 public( n )
  79.         end
  80. end
复制代码
提示runtime error(C++ Library)
然后我换成load
  1. temp = Dir.getwd
  2. $:.push(temp)
  3. load 'gl.so'
  4. load 'glu.so'
  5. load 'glut.so'

  6. include Gl,Glu,Glut

  7. # (Gl.)glVertex -> GL.Vertex
  8. # (Gl::)GL_TRUE -> GL::TRUE
复制代码
提示game.exe遇到问题需要关闭
这怎么办?
广告位招租
以下为广告位:
1、TCC for RGSS
2、空
3、空
4、空
5、空

神隐的主犯

梦石
0
星屑
553
在线时间
271 小时
注册时间
2008-2-22
回帖
7534

贵宾

发表于 2010-8-30 12:27:26 | 显示全部楼层
RM 无法使用 so 库

评分

参与人数 3星屑 +1002 收起 理由
gjz010 + 2 我很赞同
「旅」 + 202 认可答案
灼眼的夏娜 + 798

查看全部评分


《天空之城 —— 破碎的命运》
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部