Sorry if the question was already answred, but i’d like to restrict my project to compile with only Erlang 24.x.y.z. By using this:
or even this:
it still accepts to compile with Erlang 25 (which i want to prevent).
Yeah, you can do this. This is not officially documented which may or may not be intentional, so there’s that, however :
Curious, why? I suspect it’s that your app simply isn’t ready yet…
@starbelly thanks for the tip. And yes, some of our apps aren’t ready for 25 yet.
You can also use
-onload directive to detect current major release and exit not ok, with a log and message on stdout.
@crownedgrouse thank you but we can’t afford building a release, deploying to finally detect the Erlang version isn’t the right one.
Stick the following in some .erl or .hrl that’s always compiled into the thingy:
-if(?OTP_RELEASE =/= 24).
-error("OTP =/= 24").
Not talking about deployment here.
Unit test and common test will fail.
If your real question : how to detect i’m not using a module or function not available in 24.x.y ?
Your should use my project Geas with frame and range parameter.
Thanks for all your answers guys.