gen_server:handle_call & -ifdef

Gerald Biederbeck Gerald.Biederbeck@REDACTED
Thu Nov 2 17:37:55 CET 2000


Hi,

I wrote a gen_server and tried to compile it:
the source code is something like this:

>	-ifdef(erlang_debug).
>
>		handle_call(aaa, From, State) ->
>   			Reply = aaa,
>  		{reply, Reply, State};
>
>	-endif.
>
>	handle_call(Request, From, State) ->
>   		Reply = ok,
>    	{reply, Reply, State}.

The error I got was:

>	./ifdef.erl:91: unterminated '-ifdef'

I assume that it must have something to do 
with "not ending with a dot" before '-endif.', 
because the following works:	

>	-ifdef(erlang_debug).
>
>		handle_call(aaa, From, State) ->
>   			Reply = aaa,
>	    	{reply, Reply, State};
>	
>		handle_call(Request, From, State) ->
>   			Reply = ok,
>	    	{reply, Reply, State}.
>
>	-else.
>
>		handle_call(Request, From, State) ->
>   			Reply = ok,
>    		{reply, Reply, State}.
>
>	-endif.


Is there any documentation for this '-ifdef().'???
Is the second way as I am supposed to do it?

Any help and comments are welcome!

Regards
/Gerry



More information about the erlang-questions mailing list