I built the ruby create layout example using the latest sketchup api API Version 5.0 in VS2015, but trying to run it in sketchup gives the following error message:
Error: #<LoadError: 126: The specified module could not be found. - C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/CreateLayOutExample.so>
C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/createLayOut.rb:29:in `require_relative'
C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/createLayOut.rb:29:in `run'
C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/createLayOut.rb:108:in `block in <module:CreateLayOutExample>'
SketchUp:1:in `call'
The so module file does exist at that location, and I’m not really sure where to go from here. Does anyone have any ideas?
This is the error message you’d get IF the file did not exist (or you gave the wrong path): Error: #<LoadError: cannot load such file -- CreateLayOutExample.so>
This is not the error you are seeing. (:Jedi_mind_trick:)
(1) The C-side entry function name suffix must be the same as the library filename.
So if the filename is “CreateLayOutExample.so”, then the entry point
function name must be “Init_CreateLayOutExample()”.
This is a Ruby C extension thang, and not specific to SketchUp.
(2) Make sure the binary library’s bitness matches that of the SketchUp edition.
(You cannot load a 64-bit binary into a 32-bit Ruby subprocess, or visa versa.)
(3) Make sure you use the correct Ruby version libraries …
<2014 : v 1.8.6-p287 2014..2016 : v 2.0.0-p247 2017 : v 2.2.4-p230
… and the correct SDK libraries (for the SketchUp version and bitness.)
I actually just compiled a working extension by grabbing the ruby-c-extension-examples off the Sketchup github and checking out the dev-ruby224 branch.
As for 1, 2 and 3 I had assumed that downloading the latest SDK and compiling an example project would work. Or at least have some helpful information in the README…
Thank you for the pointers but as far as I can tell though everything you pointed out is set correctly.
I’m 99% sure my issue is that I am unfamiliar with Windows development and Visual Studio in particular. Now that I have a working setup learning should be much easier, or at least possible.
Yes I mentioned it above, I just checked out more up to date example code from github and it compiled for me. GitHub - SketchUp/ruby-c-extension-examples: Ruby C extension examples I needed to check out the dev-ruby224 branch, but I think in the intervening couple of years that branch has been merged into master.
I just needed a jumping off point for my own extension & communicating with ruby. I never actually needed that specific example, especially since I believe it is up on the extension warehouse.