aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric B Merritt <[email protected]>2013-04-05 14:31:17 -0700
committerEric B Merritt <[email protected]>2013-04-05 14:31:29 -0700
commita96ae5dc597cbc01515c75fea9f41a6d79be91b3 (patch)
treebaeea4d5ff0d4ed6492d825e36a40c78aca83c4a /src
parenta55808420959bae0d9097ab97bc96e1fc4b4d19b (diff)
downloadrelx-a96ae5dc597cbc01515c75fea9f41a6d79be91b3.tar.gz
relx-a96ae5dc597cbc01515c75fea9f41a6d79be91b3.tar.bz2
relx-a96ae5dc597cbc01515c75fea9f41a6d79be91b3.zip
support both R14 'behaviours' and R15+ 'callback info'
Diffstat (limited to 'src')
-rw-r--r--src/rcl_provider.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/rcl_provider.erl b/src/rcl_provider.erl
index 750b96e..4d8f044 100644
--- a/src/rcl_provider.erl
+++ b/src/rcl_provider.erl
@@ -41,10 +41,28 @@
-opaque t() :: {?MODULE, module()}.
+
+-ifdef(have_callback_support).
+
-callback init(rcl_state:t()) -> {ok, rcl_state:t()} | relcool:error().
-callback do(rcl_state:t()) -> {ok, rcl_state:t()} | relcool:error().
-callback format_error(Reason::term()) -> iolist().
+-else.
+
+%% In the case where R14 or lower is being used to compile the system
+%% we need to export a behaviour info
+-export([behaviour_info/1]).
+-spec behaviour_info(atom()) -> [{atom(), arity()}] | undefined.
+behaviour_info(callbacks) ->
+ [{init, 1},
+ {do, 1},
+ {format_error, 1}];
+behaviour_info(_) ->
+ undefined.
+
+-endif.
+
%%%===================================================================
%%% API
%%%===================================================================