Skip to content

Instantly share code, notes, and snippets.

@pcapriotti
Created July 10, 2010 14:54
Show Gist options
  • Save pcapriotti/470754 to your computer and use it in GitHub Desktop.
Save pcapriotti/470754 to your computer and use it in GitHub Desktop.
From 6efed7c47bb0f0b2af835061a3993c705ba058b7 Mon Sep 17 00:00:00 2001
From: Paolo Capriotti <p.capriotti@gmail.com>
Date: Sat, 10 Jul 2010 15:50:21 +0100
Subject: [PATCH] Initial port to rubinius.
---
src/CMakeLists.txt | 3 +++
src/Qt.cpp | 6 +++++-
src/qtruby.cpp | 3 +++
3 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6116969..f7dbdb4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -25,6 +25,9 @@ set(qtrubyshared_LIB_SRCS
set(qtruby_LIB_SRCS qtruby.cpp)
+set(CMAKE_SHARED_LINKER_FLAGS "")
+set(CMAKE_MODULE_LINKER_FLAGS "")
+
# Use 'MODULE' instead of 'SHARED' so that qtruby will be built as a bundle on Mac OS X
# instead of a dyld. But is this correct (rjd)? It needs testing.
add_library(qtruby4shared SHARED ${qtrubyshared_LIB_SRCS})
diff --git a/src/Qt.cpp b/src/Qt.cpp
index 88a88d1..00c21d1 100644
--- a/src/Qt.cpp
+++ b/src/Qt.cpp
@@ -44,6 +44,7 @@
#include <QtGui/qpolygon.h>
#include <QtGui/qtextformat.h>
#include <QtGui/qwidget.h>
+#include <QDebug>
#ifdef QT_QTDBUS
#include <QtDBus/qdbusargument.h>
@@ -60,7 +61,10 @@
#define HAS_BOOL
#endif
+extern "C"
+{
#include <ruby.h>
+}
#include <smoke/smoke.h>
#include <smoke/qtcore_smoke.h>
@@ -297,7 +301,7 @@ Binding::callMethod(Smoke::Index method, void *ptr, Smoke::Stack args, bool /*is
}
// If the virtual method hasn't been overriden, just call the C++ one.
// During GC, avoid checking for override and just call the C++ version
- if (rb_during_gc() || rb_respond_to(obj, rb_intern(methodName)) == 0) {
+ if (rb_respond_to(obj, rb_intern(methodName)) == 0) {
return false;
}
QtRuby::VirtualMethodCall c(smoke, method, args, obj, ALLOCA_N(VALUE, smoke->methods[method].numArgs));
diff --git a/src/qtruby.cpp b/src/qtruby.cpp
index 77afca8..180d70a 100644
--- a/src/qtruby.cpp
+++ b/src/qtruby.cpp
@@ -54,7 +54,10 @@
#include <smoke/qtsvg_smoke.h>
#include <smoke/qtdbus_smoke.h>
+extern "C"
+{
#include <ruby.h>
+}
#include "marshall_types.h"
#include "qtruby.h"
--
1.7.0.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment