[erlang-questions] Strange behaviour of atoms in NIF
Sverker Eriksson
sverker@REDACTED
Thu Sep 15 12:32:13 CEST 2011
Dmitry Groshev wrote:
> I'm writing a NIF-based circular array library and experiencing a strange
> behaviour of atoms in there. I have a NIF that should return an atom. It's
> fairly simple, but I get different atoms when calling this NIF from
> different places. Here is an issue with quite comprehensive explanation,
> please take a look at it at github:
> https://github.com/band115/ecirca/issues/31 I've tried to compare atoms that
> are returned by printf'ing them, but they seems identical in despite of
> obvious difference in shell.
>
>
>
NIF debugging tip #1:
int erts_printf(const char *, ...);
Works the same as printf with the additional feature of %T to print
ERL_NIF_TERM's.
Is not part of the official API (yet) and does therefore not work on
Windows.
NIF debugging tip #2:
Use debug compiled emulator.
> cd $ERL_TOP/erts/emulator
> make FLAVOR=smp debug (or FLAVOR=plain)
> $ERL_TOP/bin/cerl -debug
/Sverker, Erlang/OTP Ericsson
More information about the erlang-questions
mailing list