All Projects → SketchUp → ruby-c-extension-examples

SketchUp / ruby-c-extension-examples

Licence: MIT license
Ruby C extension examples

Programming Languages

C++
36643 projects - #6 most used programming language
ruby
36898 projects - #4 most used programming language
c
50402 projects - #5 most used programming language
SWIG
194 projects

Projects that are alternatives of or similar to ruby-c-extension-examples

py-lz4framed
LZ4-frame library for Python (via C bindings)
Stars: ✭ 42 (-4.55%)
Mutual labels:  c-extension
python-whirlpool
Python wrapper extension for C Whirlpool digest reference implementation.
Stars: ✭ 18 (-59.09%)
Mutual labels:  c-extension
ruby-magic
Simple interface to libmagic for Ruby Programming Language
Stars: ✭ 23 (-47.73%)
Mutual labels:  c-extension
fastnumbers
Super-fast and clean conversions to numbers.
Stars: ✭ 85 (+93.18%)
Mutual labels:  c-extension
PyGreSQL
The official PyGreSQL repository
Stars: ✭ 29 (-34.09%)
Mutual labels:  c-extension
testup-2
TestUp 2 for SketchUp - A GUI wrapper for running Minitest in SketchUp
Stars: ✭ 21 (-52.27%)
Mutual labels:  sketchup
sketchup-shapes
Shapes adds new tools for drawing more shapes and primitives in SketchUp.
Stars: ✭ 19 (-56.82%)
Mutual labels:  sketchup
sketchup-console-plus
A better Ruby Console and IDE for integrated development in SketchUp.
Stars: ✭ 31 (-29.55%)
Mutual labels:  sketchup
SketchUpNET
SketchUp C# API - A C++/CLI API Wrapper for the Trimble(R) SketchUp(R) C API
Stars: ✭ 83 (+88.64%)
Mutual labels:  sketchup
ruby-api-stubs
Auto-generated stubs for the SketchUp Ruby API. Useful for IDE intellisense and auto-complete.
Stars: ✭ 19 (-56.82%)
Mutual labels:  sketchup
sketchup-ruby-debugger
Ruby API debugger for SketchUp 2014 and later.
Stars: ✭ 62 (+40.91%)
Mutual labels:  sketchup
sketchup-bridge
A bidirectional communication system between WebDialogs and the SketchUp Ruby environment
Stars: ✭ 16 (-63.64%)
Mutual labels:  sketchup
SketchAR
SketchUp model into ARKit. Use SketchUp home remodel and Apple's ARKit (beta) for augmented reality. Goal: import a model (in this case, a remodel) to overlay onto existing real world that you can walk around and 'experience' and compare.
Stars: ✭ 41 (-6.82%)
Mutual labels:  sketchup

SketchUp Ruby C/C++ Extension Examples

This project includes the Ruby lib and header files used by SketchUp.

C++ Example - Hello World

Visual Studio 2019

(For older Visual Studio versions, check out the commits prior to the VS2017 tag.)

Notes on how the solution is set up:

  • The project name must match the name of the Init_*() function. Example: If the project name is HelloWorld the init function must be named Init_HelloWorld.
  • The init function must be exported in the .def file - named the same as the project.

Debugging

The Visual Studio project is set up to launch SketchUp and then load the built Ruby C Extension so you can debug your code. The various build configuration is set up to launch different SketchUp versions. Refer to the project configuration and make your adjustments as needed:

SUEX_HelloWorld > Right Click > Configuration Properties > Debugging

Xcode 8

Xcode project is set up to build targets all the way back to Ruby 1.8.

Windows and Runtime DLLs

SketchUp itself builds Ruby with dynamic CRT - using the /MD flag.

SU2014 - SU2016 used VS2010 runtime. The SketchUp installer will install the required runtime on the user machine if needed. This mean that if you build your extension with /MD with the same CRT you don't have to worry about this.

However, if you built with another CRT you have to ensure yourself that it's installed on the user's machine - which isn't trivial for a Ruby extension unless you bundle an installer with it.

This then poses a challenge when you want to support SU2017 which uses VS2015 runtime and also older versions that uses VS2010 runtimes. Either you need to build your C extensions with different VS compiler versions, or you need to ensure yourself the runtimes are on the user machine.

The runtimes libraries will usually be on a user machine, but you might experience some users with brand new machines or when a runtime is brand new that some doesn't.

Incidentally we have upgraded the Ruby version at the same time as we upgraded the compiler version. But that's just by chance.

Because of this you might want to build your extensions with /MT. However, the Ruby config files are not set up for that by default. Hence the need to define from extra macros as seen the TestUp project. This is because there are some differences between /MD and /MT that would otherwise create compile errors.

Statically linking the CRT in my C extensions means they will be bigger, but you don't have to worry about the user not having the required DLLs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].