1

I have this code : inside "Sound.rb"

module SDL   
    extend DL::Importer
    dlload(Sketchup.find_support_file("SDL.dll","Tools/Sketchyphysics3/sdl/"))
    extern "int SDL_Init(int)"
    etc....
end 

module MSketchyPhysics3
    class SPSounds
        def initialize
            SDL.SDL_Init(0x00000010) 
            etc...
        end
    end
end

Now I'm getting this error ::

String doesn't compile: undefined method `call' for nil:NilClass#<NoMethodError: undefined method `call' for nil:NilClass>
.............  sound.rb:11:in `SDL_Init'

I think it's related to calling module method from another module class , but I can't fix it. This is an old rb I'm trying to fix, this code works with ruby 1.8 but not with ruby 2.0.0

MTriple
  • 53
  • 5
  • Is `SDL_Init` defined in `DL::Importer`? Are you able to call that method from anywhere else, like IRB or unit tests? – pdoherty926 Jul 08 '14 at 05:02
  • i dont know what u mean! SDL_Init is a method of SDL.dll file. and its exist 100% im learning ruby "noob" i tried to call "SDL_Init(0x00000010)" inside "module SDL" same error . – MTriple Jul 08 '14 at 05:20
  • @pdoherty926 From what I see here I guess that `extern "int SDL_Init(int)"` is supposed to create the `SDL_Init` method throug meta programming. – tessi Jul 08 '14 at 07:48
  • 1
    thats right, now calling this method is cazing the problem, im 90% sure its something with class method and module . – MTriple Jul 08 '14 at 08:17
  • 1
    You tagged this question with "sketchup" - it never used Ruby 1.9. Why are you trying to compile for 1.9? – thomthom Jul 10 '14 at 07:49
  • sketchup 14 uses ruby 2 or 1.9 ? i though it was 1.9 _ i checked it now RUBY_VERSION its 2.0 ,srry for this . – MTriple Jul 10 '14 at 12:36
  • Issue still persist with 2.0? – thomthom Jul 11 '14 at 17:41
  • thomthom, i'm trying to get sketchyphisics breaths again(u know this plugin). this issue with sketchup 14 - ruby 2.0.0 . but with sketchup 7-8 ruby 1.8.0 . this issue is not exist as far as i know. for more details http://sketchucation.com/forums/viewtopic.php?f=61&t=58412 . – MTriple Jul 13 '14 at 01:42

0 Answers0