I see this thread is almost ten years old, but has this issue ever actually gotten fixed?
Latest posts made by johnzdennis
-
RE: Suggestion for code - Minimize (rollup) Outliner
-
RE: Getting Ruby C Extensions to work with 64-bit Windows
HE SHOOTS HE SCORES!
That fixed it - thanks so much!
-
RE: Getting Ruby C Extensions to work with 64-bit Windows
So I'm running into a new issue; not sure if this has been encountered by anyone else, but building a "Debug" version of SUEX_HelloWorld works fine (Debug 2.0/x64) works fine, but trying to build a "Release" version fails with a bunch of C2375 errors (redefinition; different linkage) for a bunch of geometric functions. SWIG doesn't have the same problem. Any ideas?
-
RE: Getting Ruby C Extensions to work with 64-bit Windows
Of course! I feel quite silly (my only defense is that I'm very much a novice with Visual Studio). Thanks very much for the response - in a bit I'll write up a simple walkthrough in case someone else stumbles into this thread in the same situation that I was in.
-
Getting Ruby C Extensions to work with 64-bit Windows
I've downloaded the C extension examples from the repository at github.com/SketchUp/ruby-c-extension-examples and played around with them a bit in Visual Studio 2015.
When I try to build them, the Hello World example builds fine, but when I try to run it in Sketchup I get the following error:
@unknownuser said:
require 'SUEX_HelloWorld'
Error: #<LoadError: 193: %1 is not a valid Win32 application. - C:/code/ruby-c-extension-examples-master/ruby-c-extension-examples-master/Debug (1.8)/SUEX_HelloWorld.so>The SUEX_UsingSWIG fails to build courtesy of a "MSC version unmatch: _MSC_VER: 1600 is expected" error.
I found the following thread http://forums.sketchup.com/t/call-c-from-ruby-in-sketchup/17272/8 with some talk about previous versions of Visual Studio (2010 and 2013) but the current example repository has comments about making changes to allow for a VS2015 so...
I guess my main question is whether I need to make some changes to the Visual Studio project (settings somewhere?) to get it to build for 64 bit (I'm running SketchUp Pro 2016 on 64-bit Windows 10)? Or is there some other issue?
If I can just get the Hello World example to run I'll be off and running, but I've reached the point where I'm stumped. Thanks for any help.
-
RE: Cannot get C extensions to run in Sketchup
Well that was hell in a bucket. Thom's advice looks like it was solid; I'd forgotten that I had to install oily_png as a ruby gem and in doing so it compiled for Ruby 2.0.0; that's why it worked. So far I've tried repackaging some C code as a gem and then installing it so it uses the 2.0.0 compiler; that gets a "true" response when I require it from the Sketchup ruby console, so...hooray. Seems like I'm making progress.
-
RE: Cannot get C extensions to run in Sketchup
Thanks - I'll give that a look and see. I originally discounted it since Oily_PNG has survived several Sketchup updates without going sour on me, but it's definitely worth inspecting.
As far as my purposes, most of what I'm doing will have to do with pixel counting and generating overlay images of PNG's. I can do it fine in Ruby but it's slow; when dealing with larger images I really want something that can kick it into higher gear.
-
RE: Cannot get C extensions to run in Sketchup
Curiously, if I compile on a Linux machine, I'm not seeing any joy, but I'm getting a different error:
require "C:/code/myext/myext"
Error: #<LoadError: 193: %1 is not a valid Win32 application. - C:/code/myext/myext.so>
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:45:inrequire' C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:45:in
require'
<main>:in<main>' SketchUp:1:in
eval' -
RE: Cannot get C extensions to run in Sketchup
I've nosed around in there and Hello World seems to compile okay on Visual Studio (2015, in my case) but I have no idea what to actually do with any of it - I was hoping for something more of a walkthrough in terms of:
- Here's the example repository
- Here's what to do to compile it (i.e. compile it via Visual Studio, etc.)
- Here's the output that you'll need (directory, .so file, etc.)
- Here's how to talk to it with Ruby and make use of it in Sketchup (i.e. put out a UI messagebox with "Hello World")
I hope I'm not missing anything incredibly obvious, but it's not clear to me as a novice how to progress forward with these materials.