Trouble loading ruby extension in sketchup 2015


#1

I get this error when testing out my extension in sketchup 2015:

Error Loading File C:/Users/ewilcox/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/archvision_plugin/archvision_plugin.rb
Error: #<LoadError: cannot load such file -- test_projects.so>
C:/Program Files/SketchUp/SketchUp 2015/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:45:in `require'
C:/Program Files/SketchUp/SketchUp 2015/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:45:in `require'
C:/Users/ewilcox/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/archvision_plugin/archvision_plugin.rb:37:in `execute'
C:/Users/ewilcox/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/archvision_plugin/archvision_plugin.rb:57:in `<module:ArchVisionRubyExtension>'
C:/Users/ewilcox/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/archvision_plugin/archvision_plugin.rb:20:in `<top (required)>'
C:/Program Files/SketchUp/SketchUp 2015/Tools/extensions.rb:197:in `require'
C:/Program Files/SketchUp/SketchUp 2015/Tools/extensions.rb:197:in `load'
C:/Users/ewilcox/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/archvision_plugin_extension.rb:15:in `register_extension'
C:/Users/ewilcox/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/archvision_plugin_extension.rb:15:in `<module:ArchVisionRubyExtension>'
C:/Users/ewilcox/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/archvision_plugin_extension.rb:7:in `<module:ArchVision>'
C:/Users/ewilcox/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/archvision_plugin_extension.rb:6:in `<top (required)>'

This is the code in Ruby. My extension is written in c++

I first check if the file exists, because i thought that might of been my problem but when I open sketchup the message box “Exists” pops up and then I get this error.

if (File.exist?("C://Users//ewilcox//AppData//Roaming//SketchUp//SketchUp\   2015//SketchUp//Plugins//archvision_plugin//test_projects//x64//Debug//test_projects.so"))
 
     UI.messagebox("Exists")
      
      require 'test_projects.so'

#2

Are you loading the the correct bitness for the SketchUp version you are running?
Does your extension load in standalone Ruby?
Do you have an Init_test_projects entry function in your C extension?

(When loading C extensions one normally omit the .so or .bundle extensions because they are platform specific. But that’s not the source of this issue.)


Please wrap code blocks as Preformatted Text for better readability and ensure that parts of the text isn’t lost.

I’ve edited your post manually this time.


#3

Assuming that the .so is 64 bit compatible… you are not ‘requiring’ it logically.
It’s full-path is:

so =  "C:/Users/ewilcox/AppData/Roaming/SketchUp/SketchUp 2015/SketchUp/Plugins/archvision_plugin/test_projects/x64/Debug/test_projects.so"

I’m unsure why you doubled every // and \ escaped the space ?
But assuming File.exist?(so) is true
Then you need to ‘load’ it,
I expect that $: does NOT contain the path to your Debug folder, so how can your

require 'test_projects.so'

work ? When the file’s not found in any default folder path ??
Why not require the ‘so’ by its full path?

require(so)

#4

Thank you for your help. I did end up getting it to work.