Project1

标题: so文件的问题 [打印本页]

作者: gjz010    时间: 2010-8-30 11:16
标题: so文件的问题
我想在游戏里require一个so库(opengl),可是总是出问题:
  1. #
  2. # Copyright (C) 2006 Peter McLain <[email protected]>
  3. # Copyright (C) 2007 Jan Dvorak <[email protected]>
  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遇到问题需要关闭
这怎么办?
作者: 八云紫    时间: 2010-8-30 12:27
RM 无法使用 so 库




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1