[erlang-questions] Using -callback with libraries supporting R14 and higher

Anthony Molinaro <>
Wed Feb 20 02:49:35 CET 2013


That's all fine adn good for some projects (especially ones essentially owned by one person), this particular one is for thrift so just forcing users to upgrade is not necessarily possible.

However in the case of thrift I use rebar to build the erlang bindings so should be able to do some sort of detection and setting of a -D flag.  I was mostly just wondering what others might be doing.

Also in this case the complaint was "the dialyzer gives me a warning about callbacks not being defined" so my advice was use the dialyzer option to turn off that warning and plan to re-enable it after r14 is officially deprecated by Ericsson (which is about the time r19 comes out I think, not sure if it was 5 versions back or not).

It's probably a more conservative answer, but I want to support the largest user base possible,

-Anthony

On Feb 19, 2013, at 4:06 PM, Loïc Hoguin <> wrote:

> Learn to say "no" to your users, in this case with a reason similar to "we only support behaviours in R15+". I occasionally receive bug reports about Ranch not building in R14, my answer is "upgrade or fork and fix on your own". May sound harsh, but there's more important work to do, you have to draw the line somewhere. Nobody complained so far.
> 
> Anthony Molinaro <> wrote:
> 
>> Hi,
>> 
>> I recently was asked to add -callback support to a library I maintain
>> because someone was getting warnings from dialyzer.  Upon looking into
>> it I don't see any way to support both R14 and R15.
>> 
>> The -callback attribute seems to cause syntax errors with the R14 compiler.
>> If you include both with R15 you get an error about how you can't use them
>> together.
>> 
>> I know it's possible using a -D flag and some conditional macros, but that
>> requires integration with the build system (and despite its wide appeal,
>> rebar is not the only game in town, some people use EMakefiles, some
>> GNU autotools, etc).
>> 
>> Does OTP provide some sort of macro definition, similar to say ?MODULE
>> which provides the version of OTP?  If not how are other library
>> maintainers providing versions for multiple incompatible OTP releases?
>> 
>> -Anthony
>> 
>> -- 
>> ------------------------------------------------------------------------
>> Anthony Molinaro                           <>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list