anchor.diff:  %% the generated `.erl' and `.hrl' files. Default is the same
   %% directory as for the proto `File'.
   %%
  +%% The `nif' option will cause the compiler to generate nif C++ code
  +%% for that can be linked with the Google protobuf C++ library. The
  +%% purpose for this is speed: the Google protobuf C++ is faster than
  +%% the interpreted Erlang code, but will also lock up an Erlang
  +%% scheduler for as long as it takes for the Google protobuf library
  +%% to complete. This is normally a small amount of time, but can be a
  +%% longer time for huge messages.  The generated nif code can be
  +%% compiled with Erlang R14B or later. The `gpb_compile' will only
  +%% generate C++ code, it will <i>not</i> compile the generated C++
  +%% code for you. Below is an example of how to generate and compile
  +%% the C++ nif code under Linux. Details may differ from system to
  +%% system.
  +%%
  +%% <pre>
  +%%      # Use protoc to generate C++ code, and compile it.
  +%%      # This will generate x.pb.cc and x.pb.h from x.proto.
  +%%      protoc --cpp_out=$PWD x.proto
  +%%      g++ -g -fPIC -O3 -I/path/to/protobuf-include -o x.pb.o -c x.pb.cc
  +%%      # Generate Erlang code and C++ nif glue code, and compile it.
  +%%      # This will generate x.erl, x.hrl and x.nif.cc from x.proto.
  +%%      erl -boot start_clean -pa /path/to/gpb/ebin -noshell -noinput +B \
  +%%            -I$PWD -nif -s gpb_compile c x.proto
  +%%      erlc -Wall x.erl
  +%%      g++ -g -fPIC -Wall -O3 -I/path/to/protobuf -o x.nif.o -c x.nif.cc
  +%%      # Link all the C++ code together to a shared library.
  +%%      g++ -g -fPIC -shared -O3 -Wall -o x.nif.so x.nif.o x.pb.o \
  +%%            -L/path/to/protobuf-libs -lprotobuf \
  +%%            -Wl,-rpath=/path/to/protobuf-libs
  +%%      # Now, if you load x.beam into an Erlang VM, it will
  +%%      # automatically load x.nif.so which contains the nif glue C++
  +%%      code as well as the protobuf code.
  +%% </pre>
  +%%
  +%% NB: Caveats: Reloading or upgrading code compiled with the `nif'
  +%% option, might have unexpected behaviour.  The Google protobuf
  +%% library maintains a database of .proto descriptors and will
  +%% complain -- and halt the entire Erlang VM -- if you try to load nif
  +%% code in two different modules that defines a message with the same
  +%% name.  I have also seen cases where protobuf descriptors from old
  +%% versions of the nif code appears to be used even if new code has
  +%% been loaded.  The descriptor database appears to be kept as long as
  +%% the Google C++ protobuf library is loaded, and it is not possible
  +%% to control unloading of a sharerd library in Erlang, at least as of
  +%% R15B01.  Even if the code has been purged and deleted, the shared
  +%% object for the nif, and thus also for the Google protobuf library's
  +%% database, may still be kept in memory.
  +%%
  +%%
   %% The `binary' option will cause the generated and compiled code be
   %% returned as a binary. No files will be written. The return value
   %% will be on the form `{ok,Mod,Code}' or `{ok,Mod,Code,Warnings}'
   %% if the compilation is succesful. This option may be useful
  -%% e.g. when generating test cases.
  +%% e.g. when generating test cases. In case the `nif' option is set,
  +%% the `Code' will be a list of tuples: `{erl,binary()}' which
  +%% contains the erlang object byte code, and `{nif,binary()}' which
  +%% contains the C++ code. You will have to compile the C++ code with a
  +%% C++ compiler, before you can use the erlang code.
   %%
   %% The `to_msg_defs' option will result in `{ok,MsgDefs}' or
   %% `{ok,MsgDefs,Warns}' being returned if the compilation is succesful.
  
positive.code: 
  %% -- nif c++ code -----------------------------------------------------
  
  format_nif_cc(Mod, Defs, Opts, AnRes) ->
      [format_nif_cc_includes(Mod, Defs, Opts),
       format_nif_cc_local_function_decls(Mod, Defs, Opts),
       format_nif_cc_mk_atoms(Mod, Defs, AnRes, Opts),
  
negative.code: 
  %% -- compile to memory -----------------------------------------------------
  
  compile_to_binary(MsgDefs, ErlCode, PossibleNifCode, Opts) ->
      {ok, Toks, _EndLine} = erl_scan:string(flatten_iolist(ErlCode)),
      FormToks = split_toks_at_dot(Toks),
      Forms = lists:map(fun(Ts) ->
  