3

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.

Hynek -Pichi- Vychodil
  • 26,174
  • 5
  • 52
  • 73
Xavier
  • 8,828
  • 13
  • 64
  • 98

2 Answers2

4

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

Sergey Miryanov
  • 1,820
  • 16
  • 29
1

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

keymone
  • 8,006
  • 1
  • 28
  • 33