From 95936d5d43ccfa751a6fa3e7de73ca78175da603 Mon Sep 17 00:00:00 2001 From: Artur Skawina Date: Fri, 3 Feb 2012 21:27:56 +0100 Subject: [PATCH] Reenable signal callback type check. The errors printed when something is wrong may be cryptic, but the check does catch real problems, like forgetting to annotate the callback with "extern (C)". --- example_clutter1.d | 2 +- example_clutter2.d | 2 +- girtod.d | 8 +------- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/example_clutter1.d b/example_clutter1.d index bd53232..d8fac46 100644 --- a/example_clutter1.d +++ b/example_clutter1.d @@ -6,7 +6,7 @@ import std.stdio; import clut = gtk2.clutter; -int on_stage_button_press(clut.Actor* stage, clut.Event* event, void* data) +extern (C) int on_stage_button_press(clut.Actor* stage, clut.Event* event, void* data) { float x = 0, y = 0; event.get_coords(&x, &y); diff --git a/example_clutter2.d b/example_clutter2.d index cd351c3..e44ffae 100644 --- a/example_clutter2.d +++ b/example_clutter2.d @@ -6,7 +6,7 @@ import std.stdio; import clut = gtk2.clutter; -int on_stage_button_press(clut.Actor* stage, clut.Event* event, void* data) +extern (C) int on_stage_button_press(clut.Actor* stage, clut.Event* event, void* data) { float x = 0, y = 0; event.get_coords(&x, &y); diff --git a/girtod.d b/girtod.d index ff5f443..8ece810 100644 --- a/girtod.d +++ b/girtod.d @@ -969,14 +969,8 @@ final class x_function : x_elem { r ~= --indent ~ "}\n\n"; } - // Callback /type/ not checked, as doing it results in weird errors - // and very unhelpful template instantiation error messages, like: - // - // Error: template instance Clutter.Actor.signal_connect!(name,int function(Actor* stage, Event* event, void* data)) error instantiating - // instantiated from here: signal_connect!("button-press-event",int function(Actor* stage, Event* event, void* data)) - // Error: template instance Clutter.Stage.signal_connect!("button-press-event",int function(Actor* stage, Event* event, void* data)) error instantiating r ~= indent ~ `ulong signal_connect(string name:"` ~ name ~ `", `; - r ~= `CB/*:signal_` ~ validDSym(name) ~ "*/)(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {\n"; + r ~= `CB:signal_` ~ validDSym(name) ~ ")(CB cb, void* data=null, ConnectFlags cf=cast(ConnectFlags)0) {\n"; r ~= ++indent ~ `return signal_connect_data` ~ (methodtemplates ? "!()" : "") ~ `(&this, cast(char*)"` ~ name ~ "\",\n"; -- 2.11.4.GIT