2
-export([start/1, stop/0, init/1]).
3
-export([foo/1, bar/1]).
6
spawn(?MODULE, init, [ExtPrg]).
16
complex ! {call, self(), Msg},
23
register(complex, self()),
24
process_flag(trap_exit, true),
25
Port = open_port({spawn, ExtPrg}, [{packet, 2}, binary]),
30
{call, Caller, Msg} ->
31
Port ! {self(), {command, term_to_binary(Msg)}},
33
{Port, {data, Data}} ->
34
Caller ! {complex, binary_to_term(Data)}
38
Port ! {self(), close},
43
{'EXIT', Port, Reason} ->