[erlang-questions] Replace ERL_BIN_ATOM with binary/list in a C node.
Tue Jul 15 18:21:45 CEST 2014
I'm not 100% certain, but I think binaries are not NULL terminated. So, you
need to take the length of the binary into account. That obviously makes
the code change a bit harder :-(
Looking at the erl_interface code for the atom conversion, I see quite a
bit of shuffling to do with character encodings and explicit setting of \0
I think you'll need to take a copy of the binary data and slap the \0 onto
the end yourself. And you need to be aware of the character encoding you
are expecting to exchange and, if required, convert accordingly.
On 15 July 2014 16:53, pablo platt <pablo.platt@REDACTED> wrote:
> I'm using erlycairo to draw on a 2D canvas.
> There are several functions that leak atoms:
> I tried to pass a binary to the C node and use (char *)ERL_BIN_PTR(file)
> but I'm getting another char at the end of the binary.
> What is the correct way to use binaries or lists instead of atoms for the
> write_to_png function?
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions