From 57fab43cbe6ed9759e2eec89599c91f8c5868c77 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alexis=20Laferri=C3=A8re?= Date: Fri, 16 May 2014 08:44:01 -0400 Subject: [PATCH] lib/signals: fix for nitg-g MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Alexis Laferrière --- lib/signals.nit | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/lib/signals.nit b/lib/signals.nit index cb69dd7..89f4a1b 100644 --- a/lib/signals.nit +++ b/lib/signals.nit @@ -24,6 +24,21 @@ module signals #include /* + This guard prevents errors by the C compiler when the Nit code imports this + module but do not use handle_signal. When it is _not_ used, the C type + SignalHandler and C function SignalHandler_receive_signal are not generated. + Which does not please the C compiler. This guard ensure that we compile this + code only if the type SignalHandler has been defined. + + This is a HACK, FIXME by: + * Adding the macro to the FFI spec, or + * Attach the callbacks to this code block (or the module itself) + * Avoid using Nit types and callbacks or use them only in the C implementation + of Nit method. + */ + #ifdef NIT_TYPE_SignalHandler + + /* Structure to manage each possible signals are used in an array of 32 maximum signals. This array is global to the software. @@ -49,6 +64,8 @@ module signals } } } + + #endif `} # Receives the callback from system when a given signal arise -- 1.7.9.5