# Problems with the RubyExampleCreateLayOut

**URL:** <https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961>\
**Category:** Developers\
**Created:** [November 30, 2016, 5:31pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961 "2016-11-30T17:31:44Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![necronian](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@necronian](https://forums.sketchup.com/u/necronian)\
**Post date:** [November 30, 2016, 5:31pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/1 "2016-11-30T17:31:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![john\_drivenupthewall](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@john\_drivenupthewall](https://forums.sketchup.com/u/john_drivenupthewall)\
**Post date:** [November 30, 2016, 5:39pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/2 "2016-11-30T17:39:26Z")

</div>

the exact loading code is critical, what do you use?  
try this in Ruby Console…

```ruby
require 'CreateLayOutExample'

```

does it return `true` ?

john

---

<div class="post-metadata">

**Author:** ![necronian](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@necronian](https://forums.sketchup.com/u/necronian)\
**Post date:** [November 30, 2016, 6:30pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/3 "2016-11-30T18:30:33Z")

</div>

I get a very similar output:

```
require 'CreateLayOutExample'
Error: #<LoadError: 126: The specified module could not be found. - C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/CreateLayOutExample.so>
C:/Program Files/SketchUp/SketchUp 2017/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/Program Files/SketchUp/SketchUp 2017/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:54:in `require'
<main>:in `<main>'
SketchUp:1:in `eval'

```

---

<div class="post-metadata">

**Author:** ![john\_drivenupthewall](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@john\_drivenupthewall](https://forums.sketchup.com/u/john_drivenupthewall)\
**Post date:** [November 30, 2016, 7:11pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/4 "2016-11-30T19:11:45Z")

</div>

it may be a Ruby 2.2 issue, does it work in v16?

john

---

<div class="post-metadata">

**Author:** ![necronian](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@necronian](https://forums.sketchup.com/u/necronian)\
**Post date:** [November 30, 2016, 7:22pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/5 "2016-11-30T19:22:55Z")

</div>

No, still the same issue

```
Error: #<LoadError: 126: The specified module could not be found. - C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/CreateLayOutExample.so>
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:45:in `require'
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:45:in `require'
C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/createLayOut.rb:29:in `run'
C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/createLayOut.rb:108:in `block in <module:CreateLayOutExample>'
SketchUp:1:in `call'

```

I decided to double check that it actually exists, but it does.

```
File.file?('C:/Users/richard/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/CreateLayOutExample.so')
true

```

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [December 1, 2016, 11:53am UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/6 "2016-12-01T11:53:07Z")

</div>

> [@necronian](#):
>
> I decided to double check that it actually exists, but it does.

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.)

---

<div class="post-metadata">

**Author:** ![necronian](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@necronian](https://forums.sketchup.com/u/necronian)\
**Post date:** [December 1, 2016, 12:18pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/7 "2016-12-01T12:18:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [December 1, 2016, 12:38pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/8 "2016-12-01T12:38:21Z")

</div>

> [@necronian](#):
>
> Or at least have some helpful information in the README…

I think Thomas (@tt_su) has recently mentioned something about a tutorial on the “to do” list ?

---

<div class="post-metadata">

**Author:** ![tt\_su](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/tt_su/32/17_2.png) [@tt\_su](https://forums.sketchup.com/u/tt_su)\
**Post date:** [December 22, 2016, 12:47pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/9 "2016-12-22T12:47:00Z")

</div>

Please see this thread which appear to be related: [The SketchUpAPI & LayOutAPI 2017 SDK Bug! - #2 by tt\_su](http://forums.sketchup.com/t/the-sketchupapi-layoutapi-2017-sdk-bug/36164/2)

---

<div class="post-metadata">

**Author:** ![jiminybillybob](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/jiminybillybob/32/197139_2.png) [@jiminybillybob](https://forums.sketchup.com/u/jiminybillybob)\
**Post date:** [December 6, 2018, 6:11pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/10 "2018-12-06T18:11:35Z")

</div>

@necronian Did you ever fix the LoadError issue?

---

<div class="post-metadata">

**Author:** ![necronian](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@necronian](https://forums.sketchup.com/u/necronian)\
**Post date:** [December 6, 2018, 7:09pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/11 "2018-12-06T19:09:00Z")

</div>

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](https://github.com/SketchUp/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.

---

<div class="post-metadata">

**Author:** ![jiminybillybob](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/jiminybillybob/32/197139_2.png) [@jiminybillybob](https://forums.sketchup.com/u/jiminybillybob)\
**Post date:** [December 6, 2018, 7:20pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/12 "2018-12-06T19:20:13Z")

</div>

Ok so you created a new project, you didn’t fix the issue in the original one?

---

<div class="post-metadata">

**Author:** ![necronian](https://avatars.discourse-cdn.com/v4/letter/n/b4bc9f/32.png) [@necronian](https://forums.sketchup.com/u/necronian)\
**Post date:** [December 6, 2018, 7:44pm UTC](https://forums.sketchup.com/t/problems-with-the-rubyexamplecreatelayout/34961/13 "2018-12-06T19:44:57Z")

</div>

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.
