sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Getting Ruby C Extensions to work with 64-bit Windows

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 3 Posters 1.3k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      johnzdennis
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        Remember to pick the correct build configuration for the SketchUp version you launch.

        msvc-build-config.gif

        Not sure about the SWIG project - just remove it if you don't intend to use it.

        Thomas Thomassen — SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • J Offline
          johnzdennis
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            No worries. Nothing is obvious when you are new to it.
            We (SketchUp) actually have a tutorial on this planned. Hope to have it published later this fall.

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • J Offline
              johnzdennis
              last edited by

              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?

              1 Reply Last reply Reply Quote 0
              • J Offline
                Jim
                last edited by

                Check out this issue on the GitHub Repo:

                Link Preview Image
                Build failed for Release (2.0) x64 platform · Issue #6 · SketchUp/ruby-c-extension-examples

                Using VS Express 2015 for Windows Desktop. I had to change the Runtime Library to use the /MD option instead of the /MT option in order to build SUEXT_HelloWorld for Release (2.0) on the x64 Platform. Properties > C/C++ > Code Generation...

                favicon

                GitHub (github.com)

                Thom posted a revised RubyLib.h file that fixes these.

                Hi

                1 Reply Last reply Reply Quote 0
                • J Offline
                  johnzdennis
                  last edited by

                  HE SHOOTS HE SCORES!

                  That fixed it - thanks so much!

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement