[Tutorial] SketchUp Ruby C Extension
-
Right. Should I leave the other folders alone?
Just thinking it might be nice with a repo just for C Extension - nothing else. Just to keep it clean and simple.
-
https://github.com/sketchucation is ready to accept projects
-
@unknownuser said:
https://github.com/sketchucation is ready to accept projects
Right'o. So can we create an "SketchUp Ruby C Extension" project? Then start adding stuff.
-
pull requests away - https://github.com/sketchucation/suext
-
I just got a very simple Hello World example working under OSX. Will create another example with some basic Ruby object interactions and expand a little on my comments. Then I will upload it to a repository. Think I'll focus on the step by step for OSX first to get the structure up. Then Windows - seem to be a bit more tweaking to get that working.
-
This sounds great Thom and TBD and everyone one else who gets involved. I keep being afraid that I might need to learn some of this for my upcoming work.
Chris
-
What you got cooking?
-
Right - attempting to build on Windows.
I have Visual C++ Express 201 installed and I'm trying to build using nmake. Getting some errors:
I'm not sure what that means. Though I have a suspicion I need to specify the path to where windows.h is located... Though I don't know where to do so...
-
Uploaded my WIP at: https://bitbucket.org/thomthom/sketchup-ruby-c-extension/
Working on OSX 10.5.
-
-
Think I got one step further. This thread mentions that vcvars32.bat needs to be run from the prompt: http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/325b5459-c469-40d0-bf6d-e3356a2f14cd/
And this (http://stackoverflow.com/questions/6622869/problem-with-nmake)
So after I did that I got a different error. Missing crt file...
-
( Apologies for those with the know-how - I will be posting lots of silly stuff as I work through this. Posting to make a record of what I am doing. "Thinking out loud". )
-
Got it working!
Uncommented a
#pragma comment(lib, "crt.lib");
I had. TBD's SUExt project had a reference to it. Which is what I based my project on. Seeing how it also referred to#pragma comment(lib, "msvcrt-ruby18.lib");
I just tried to see what happened if I removed the ref to crt.lib. Everything worked fine after that point.Now I wonder what the other lines do:
#pragma comment(lib, "kernel32.lib") #pragma comment(lib, "gdi32.lib") #pragma comment(lib, "user32.lib") #pragma comment(lib, "shell32.lib")
I'm looking at this tutorial: http://blogs.law.harvard.edu/hoanga/2006/12/14/getting-a-ruby-c-extension-to-compile-on-windows/
It made no reference to any of this. ( what is it? Is it really required? )I'm guessing
#include <windows.h>
is required though. -
Now... I'd like to find a way to make any output from extconf.rb and make/nmake put everything is a separate directory - for each platform.
-
Huh... I removed all of that stuff completely, as http://blogs.law.harvard.edu/hoanga/2006/12/14/getting-a-ruby-c-extension-to-compile-on-windows/ made no reference to it at all. Worked fine without. Guess it was required due to the way the Pelles C project was set up...
-
Hey Chris, when we get around to writing up the step by step instructions, are you willing to be a guinea pig?
-
Absolutely!
-
Great!
I'm writing up a Basic example that shows a little more than Hello World.
Then I start on making the step by step Wiki tutorial. I hope people with more know how can fill the in the "why" to much of it. And that people will try it and give feedback on what is unclear and what turns out not to work.
-
@thomthom said:
Though I have a suspicion I need to specify the path to where windows.h is located... Though I don't know where to do so...
To do so via the IDE... from the menu Tools > Options...
.. brings up the "Options" dialog.
Choose "VC++ Directories" from the "Projects and Solutions" branch in the nav tree.
You can see the dirs for catagories by selecting the cat from the "Show directories for:" dropdown control:Executable files:
Include files:
-
Don't forget the "help" topic here:
[Info] C/C++ Ruby extensions & SketchUp plugins
.. and read Adan Nelson's posts (links on the above list.)
Advertisement