Testing Ruby VALUES in C-extension.
-
Came across this article today: http://silverhammermba.github.io/emberb/c/#exceptions
Nice little overview over the Ruby C API.
-
good article - it has already answered some of my questions.
-
It explains the important parts better than the Ruby C API readme:
https://github.com/ruby/ruby/blob/trunk/README.EXT -
I just came accross an issue you guys should know about (if you don't already) : We can't pass more than 15 arguments in a single function from ruby to C++.
-
It looks like I'll have to use the visual studio compiler for c extensions in sketchup.
There is an MS specific config file and no other counterparts for borland etc.ThirdParty\include\ruby\2.0\win32\i386-mswin32_100\ruby\config.h
-
@jiminy-billy-bob said:
I just came accross an issue you guys should know about (if you don't already) : We can't pass more than 15 arguments in a single function from ruby to C++.
You actually hit that limit?
-
@garry k said:
It looks like I'll have to use the visual studio compiler for c extensions in sketchup.
There is an MS specific config file and no other counterparts for borland etc.ThirdParty\include\ruby\2.0\win32\i386-mswin32_100\ruby\config.h
For the examples we provided projects only for Visual Studio on Windows and Xcode on OSX. If you want to compile with another compiler you are free to do so - but we don't provide examples for all compilers.
-
@tt_su said:
@jiminy-billy-bob said:
I just came accross an issue you guys should know about (if you don't already) : We can't pass more than 15 arguments in a single function from ruby to C++.
You actually hit that limit?
Well... I try to limit the back-and-forth between ruby and C++, so I pass all the information in one go, and treat everything in C++.
-
@jiminy-billy-bob said:
@tt_su said:
@jiminy-billy-bob said:
I just came accross an issue you guys should know about (if you don't already) : We can't pass more than 15 arguments in a single function from ruby to C++.
You actually hit that limit?
Well... I try to limit the back-and-forth between ruby and C++, so I pass all the information in one go, and treat everything in C++.
A Hash would be good to pass instead - much easier to manage whenever you change some of the data you pass. No need to worry about changing argument order etc.
-
I have a good start on SUEX_HelloWorld using C++Builder 6
I've added cbuilder folder at the same level as the i386-mswin32_100 folder. Then I added a ruby folder and copied over the config.h files. Then I've edited the config files. I'm happy to say that I didn't have to edit any other 3rd party file.
Then I ran implib.exe -a msvcrt-ruby200.lib msvcrt-ruby200.dll and created Borland's flavor of each lib file.
After that I set up a couple of include file paths and added msvcrt-ruby200.lib to the probject.
Turned off precompiled headers and unchecked use dynamic rtlI now have it compiling - but currently just for the win32 flavor for SU 2014
Now for a bit of testing.Hopefully I'm on the right path. I'm pretty sure I need to export the function as cdecl for this to work.
-
Turns out it's a stdcall which has no mangling.
I can debug the c extension in CBuilder. Very fast.
Now I need to experiment with arguments etc. That will be the acid test for stdcall
If anyone is interested I can post the files and the steps.Once I get a real good handle on this I'll try it out with XE7 which is a compiler that compiles Win32, Win64 and OSX.
I will also test this on my lap top where Borland memory manager (a dll) doesn't exist. It will tell me if I need to include any of these files or not.
Advertisement