This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d:\lib\qt5\ext>cl /LD /W0 /I d:\gc-7.6.0\include /I C:\Qt\Qt5.9.2\5.9.2\msvc2015_64\include qt_binding.cpp /link d:\gc.lib /LIBPATH:c:\Qt\Qt5.9.2\5.9.2\msvc2015_64\lib Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib | |
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24210 for x64 | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
qt_binding.cpp | |
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\iosfwd(343): warning C4577: 'noexcept' used with no exception handling mode specified; termination on exception is not guaranteed. Specify /EHsc | |
Microsoft (R) Incremental Linker Version 14.00.24210.0 | |
Copyright (C) Microsoft Corporation. All rights reserved. | |
/out:qt_binding.dll | |
/dll | |
/implib:qt_binding.lib | |
d:\gc.lib | |
/LIBPATH:c:\Qt\Qt5.9.2\5.9.2\msvc2015_64\lib | |
Qt5Core.lib | |
Qt5Gui.lib | |
Qt5Widgets.lib | |
qt_binding.obj | |
qt_binding.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QObject * __cdecl QObject::sender(void)const " (__imp_?sender@QObject@@QEBAPEAV1@XZ) referenced in function bg_QObject_sender_ | |
qt_binding.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl QObject::senderSignalIndex(void)const " (__imp_?senderSignalIndex@QObject@@QEBAHXZ) referenced in function bg_QObject_senderSignalIndex_ | |
qt_binding.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl QObject::receivers(char const *)const " (__imp_?receivers@QObject@@QEBAHPEBD@Z) referenced in function bg_QObject_receivers_const_char_X | |
qt_binding.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl QObject::isSignalConnected(class QMetaMethod const &)const " (__imp_?isSignalConnected@QObject@@QEBA_NAEBVQMetaMethod@@@Z) referenced in function bg_QObject_isSignalConnected_const_QMetaMethod_R | |
qt_binding.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __cdecl QObject::timerEvent(class QTimerEvent *)" (__imp_?timerEvent@QObject@@UEAAXPEAVQTimerEvent@@@Z) referenced in function "public: virtual void __cdecl BgInherit_Action::timerEvent(class QTimerEvent *)" (?timerEvent@BgInherit_Action@@UEAAXPEAVQTimerEvent@@@Z) | |
qt_binding.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __cdecl QObject::childEvent(class QChildEvent *)" (__imp_?childEvent@QObject@@UEAAXPEAVQChildEvent@@@Z) referenced in function "public: virtual void __cdecl BgInherit_Action::childEvent(class QChildEvent *)" (?childEvent@BgInherit_Action@@UEAAXPEAVQChildEvent@@@Z) | |
qt_binding.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual void __cdecl QObject::customEvent(class QEvent *)" (__imp_?customEvent@QObject@@UEAAXPEAVQEvent@@@Z) referenced in function "public: virtual void __cdecl BgInherit_Action::customEvent(class QEvent *)" (?customEvent@BgInherit_Action@@UEAAXPEAVQEvent@@@Z) | |
... | |
cl -c -Zc:wchar_t -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -EHsc -W0 -DUNICODE -D_UNICODE -DWIN32 -DWIN64 -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DNDEBUG -Id:\gc-7.6.0\include -IC:\Qt\Qt5.9.2\5.9.2\msvc2015_64\include qt_binding.cpp | |
lib qt_binding.obj d:\gc.lib /LIBPATH:c:\Qt\Qt5.9.2\5.9.2\msvc2015_64\lib Qt5Widgets.lib Qt5Gui.lib Qt5Core.lib | |
$ crystal/bin/crystal build app.cr --cross-compile --target x86_64-pc-windows-msvc --no-debug | |
link app.o libevent.lib gc.lib pcre.lib kernel32.lib ws2_32.lib user32.lib /LIBPATH:c:\Qt\Qt5.9.2\5.9.2\msvc2015_64\lib Qt5Widgets.lib Qt5Gui.lib Qt5Core.lib lib\qt5\ext\qt_binding.lib /NODEFAULTLIB:msvcrt | |
link /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS /NODEFAULTLIB:msvcrt /OUT:app.exe app.o libevent.lib gc.lib pcre.lib kernel32.lib ws2_32.lib user32.lib /LIBPATH:c:\Qt\Qt5.9.2\5.9.2\msvc2015_64\lib Qt5Core.lib Qt5Gui.lib Qt5Widgets.lib lib\qt5\ext\qt_binding.lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/assets/bindgen_helper.hpp b/assets/bindgen_helper.hpp | |
index 22ee985..4fc72c1 100644 | |
--- a/assets/bindgen_helper.hpp | |
+++ b/assets/bindgen_helper.hpp | |
@@ -40,7 +40,7 @@ | |
#ifndef BINDGEN_HELPER_HPP | |
#define BINDGEN_HELPER_HPP | |
-#include <gc/gc.h> // Boehm GC | |
+#include <gc.h> // Boehm GC | |
#include <string.h> | |
#include <stdlib.h> // abort() | |
#include <stdio.h> // fprintf() | |
@@ -52,15 +52,19 @@ typedef struct CrystalString { // C compatibility | |
} CrystalString; | |
// Compiler branching hint | |
+#ifdef __GNUC__ | |
#define bindgen_likely(x) __builtin_expect(!!(x), 1) | |
+#else | |
+#define bindgen_likely(x) (x) | |
+#endif // __GNUC__ | |
-static __attribute__((noreturn)) void bindgen_fatal_panic(const char *message) { | |
+[[noreturn]] static void bindgen_fatal_panic(const char *message) { | |
fprintf(stderr, "Fatal error in bindings: %s\n", message); | |
abort(); | |
} | |
#ifdef __cplusplus | |
-#include <gc/gc_cpp.h> | |
+#include <gc_cpp.h> | |
#include <string> | |
// Break C++'s encapsulation to allow easy wrapping of protected methods. | |
diff --git a/spec/integration/basic.cpp b/spec/integration/basic.cpp | |
index 07ac1b5..9592fef 100644 | |
--- a/spec/integration/basic.cpp | |
+++ b/spec/integration/basic.cpp | |
@@ -1,7 +1,7 @@ | |
#include <cstdio> | |
#include <cstdlib> | |
#include <cstring> | |
-#include <gc/gc.h> | |
+#include <gc.h> | |
class IgnoreMe { }; | |
diff --git a/spec/integration/spec_base.yml b/spec/integration/spec_base.yml | |
index a4ebdbf..b2d2052 100644 | |
--- a/spec/integration/spec_base.yml | |
+++ b/spec/integration/spec_base.yml | |
@@ -9,7 +9,7 @@ generators: | |
# Don't barf on unused functions. Everything else: Error. | |
build: "{CXX|c++} -c -o {SPEC_NAME}.o {SPEC_NAME}.cpp -I.. -Wall -Werror -Wno-unused-function" | |
preamble: |- | |
- #include <gc/gc_cpp.h> | |
+ #include <gc_cpp.h> | |
#include "bindgen_helper.hpp" | |
crystal: | |
output: tmp/{SPEC_NAME}.cr | |
diff --git a/src/bindgen/call_builder/cpp_method.cr b/src/bindgen/call_builder/cpp_method.cr | |
index 8568840..df97384 100644 | |
--- a/src/bindgen/call_builder/cpp_method.cr | |
+++ b/src/bindgen/call_builder/cpp_method.cr | |
@@ -66,11 +66,10 @@ module Bindgen | |
def code_body(const, call, platform, prefix) | |
%[ #{const}#{@class} *_self_ = this;\n] \ | |
- %[ if (bindgen_likely(#{@virtual_target.name}.isValid())) {\n] \ | |
- %[ #{prefix}#{@virtual_target.body.to_code(@virtual_target, platform)};\n] \ | |
- %[ } else {\n] \ | |
+ %[ if (!bindgen_likely(#{@virtual_target.name}.isValid())) {\n] \ | |
%[ bindgen_fatal_panic("No implementation for pure method #{call.origin.class_name}::#{call.name}");\n] \ | |
- %[ }] | |
+ %[ }] \ | |
+ %[ #{prefix}#{@virtual_target.body.to_code(@virtual_target, platform)};\n] | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/config/classes.yml b/config/classes.yml | |
index dc17675..8049839 100644 | |
--- a/config/classes.yml | |
+++ b/config/classes.yml | |
@@ -2,8 +2,6 @@ classes: | |
QObject: Object | |
QTimer: Timer | |
"QMetaObject::Connection": SignalConnection | |
- QAbstractEventDispatcher: AbstractEventDispatcher | |
- QAbstractEventDispatcher::TimerInfo: EventDispatcherTimerInfo | |
QSocketNotifier: SocketNotifier | |
QPaintDevice: PaintDevice | |
QWidget: Widget | |
diff --git a/config/types.yml b/config/types.yml | |
index e22376f..5a93ff7 100644 | |
--- a/config/types.yml | |
+++ b/config/types.yml | |
@@ -53,23 +53,9 @@ types: # Type rewrite rules | |
# crystal_type: PainterPixmapFragment | |
# pass_by: Pointer | |
"QAbstractEventDispatcher::TimerInfo": | |
- binding_type: EventDispatcherTimerInfo | |
- generate_binding: false | |
- generate_wrapper: false | |
- copy_structure: true | |
- pass_by: Value | |
- kind: Struct | |
+ ignore: true | |
"std::chrono::milliseconds": | |
- cpp_type: int64_t | |
- binding_type: Int64 | |
- crystal_type: Time::Span | |
- generate_binding: false | |
- generate_wrapper: false | |
- pass_by: Value | |
- builtin: true | |
- to_cpp: "std::chrono::milliseconds(%)" | |
- from_cpp: "(%.count())" | |
- converter: Qt::Converter::TimeSpan | |
+ ignore: true | |
"QUrl::FormattingOptions": | |
crystal_type: Url::FormattingOptions | |
binding_type: Url::FormattingOptions | |
diff --git a/ext/bindgen_helper.hpp b/ext/bindgen_helper.hpp | |
index 22ee985..4fc72c1 100644 | |
--- a/ext/bindgen_helper.hpp | |
+++ b/ext/bindgen_helper.hpp | |
@@ -40,7 +40,7 @@ | |
#ifndef BINDGEN_HELPER_HPP | |
#define BINDGEN_HELPER_HPP | |
-#include <gc/gc.h> // Boehm GC | |
+#include <gc.h> // Boehm GC | |
#include <string.h> | |
#include <stdlib.h> // abort() | |
#include <stdio.h> // fprintf() | |
@@ -52,15 +52,19 @@ typedef struct CrystalString { // C compatibility | |
} CrystalString; | |
// Compiler branching hint | |
+#ifdef __GNUC__ | |
#define bindgen_likely(x) __builtin_expect(!!(x), 1) | |
+#else | |
+#define bindgen_likely(x) (x) | |
+#endif // __GNUC__ | |
-static __attribute__((noreturn)) void bindgen_fatal_panic(const char *message) { | |
+[[noreturn]] static void bindgen_fatal_panic(const char *message) { | |
fprintf(stderr, "Fatal error in bindings: %s\n", message); | |
abort(); | |
} | |
#ifdef __cplusplus | |
-#include <gc/gc_cpp.h> | |
+#include <gc_cpp.h> | |
#include <string> | |
// Break C++'s encapsulation to allow easy wrapping of protected methods. | |
diff --git a/ext/converters.hpp b/ext/converters.hpp | |
index 2be7682..e681805 100644 | |
--- a/ext/converters.hpp | |
+++ b/ext/converters.hpp | |
@@ -1,4 +1,4 @@ | |
-#include <gc/gc.h> // Boehm GC | |
+#include <gc.h> // Boehm GC | |
#include <cstring> | |
#include <QtCore/qbytearray.h> | |
#include <QtCore/qstring.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'int QObject::startTimer(int,Qt::TimerType)': cannot convert argument 1 from 'std::chrono::duration<__int64,std::milli>' to 'int' | |
warning C4190: 'bg_QGraphicsItem_mapToParent_qreal_qreal' has C-linkage specified, but returns UDT 'QPointF' which is incompatible with C | |
qt_binding.cpp(544): error C2039: 'intervalAsDuration': is not a member of 'QTimer' | |
c:\qt\qt5.9.2\5.9.2\msvc2015_64\include\qtwidgets\qprogressdialog.h(54): note: see declaration of 'QTimer' | |
qt_binding.cpp(544): error C2228: left of '.count' must have class/struct/union | |
qt_binding.cpp(548): error C2039: 'remainingTimeAsDuration': is not a member of 'QTimer' | |
c:\qt\qt5.9.2\5.9.2\msvc2015_64\include\qtwidgets\qprogressdialog.h(54): note: see declaration of 'QTimer' | |
qt_binding.cpp(548): error C2228: left of '.count' must have class/struct/union | |
qt_binding.cpp(846): error C2259: 'BgInherit_AbstractEventDispatcher': cannot instantiate abstract class | |
qt_binding.cpp(846): note: due to following members: | |
qt_binding.cpp(846): note: 'bool QAbstractEventDispatcher::registerEventNotifier(QWinEventNotifier *)': is abstract | |
c:\qt\qt5.9.2\5.9.2\msvc2015_64\include\qtcore\qabstracteventdispatcher.h(99): note: see declaration of 'QAbstractEventDispatcher::registerEventNotifier' | |
qt_binding.cpp(846): note: 'void QAbstractEventDispatcher::unregisterEventNotifier(QWinEventNotifier *)': is abstract | |
c:\qt\qt5.9.2\5.9.2\msvc2015_64\include\qtcore\qabstracteventdispatcher.h(100): note: see declaration of 'QAbstractEventDispatcher::unregisterEventNotifier' | |
qt_binding.cpp(934): error C2259: 'BgInherit_AbstractEventDispatcher': cannot instantiate abstract class | |
qt_binding.cpp(934): note: due to following members: | |
qt_binding.cpp(934): note: 'bool QAbstractEventDispatcher::registerEventNotifier(QWinEventNotifier *)': is abstract | |
c:\qt\qt5.9.2\5.9.2\msvc2015_64\include\qtcore\qabstracteventdispatcher.h(99): note: see declaration of 'QAbstractEventDispatcher::registerEventNotifier' | |
qt_binding.cpp(934): note: 'void QAbstractEventDispatcher::unregisterEventNotifier(QWinEventNotifier *)': is abstract | |
c:\qt\qt5.9.2\5.9.2\msvc2015_64\include\qtcore\qabstracteventdispatcher.h(100): note: see declaration of 'QAbstractEventDispatcher::unregisterEventNotifier' | |
https://doc.qt.io/qt-5/qabstracteventdispatcher.html#registerEventNotifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
download and unpack http://www.hboehm.info/gc/gc_source/gc-7.6.0.tar.gz | |
download https://github.com/ivmai/libatomic_ops/releases/download/v7.4.6/libatomic_ops-7.4.6.tar.gz | |
mv libatomic_ops-7.4.6 gc-7.6.0/libatomic_ops | |
cd gc-7.6.0 | |
wget https://gist.githubusercontent.com/ynkdir/688e62f419e5374347bf/raw/d250598ddf5129addd212b8390279a01bca12706/win32.mak | |
echo "!include <Win32.Mak>" > ntwin32.mak | |
nmake /F NT_X64_STATIC_THREADS_MAKEFILE nodebug=1 all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment