Question

What is the best way to represent a C array in Erlang? I plan on passing a C array to Erlang using NIF. The array is composed of bytes and I'll need to modify some of the bytes as the program runs. Any help is appreciated.

Was it helpful?

Solution

erlang is pretty good when dealing with binaries(essentially byte arrays right?)

check it out here: http://www.erlang.org/documentation/doc-5.6/doc/programming_examples/bit_syntax.html

OTHER TIPS

If function in NIF not reallocate array than you can represent you array as a tuple with two elements - raw pointer and elements count.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top