Erlang/OTP Forums

Author Message

<  Erlang  ~  How to marshall Erlang List -> c double myarray[] ?

riskyrisk
Posted: Wed Oct 22, 2008 3:25 pm Reply with quote
Joined: 11 Oct 2008 Posts: 8 Location: Netherlands
I've read the article here on the ei and marshalling topic:
http://www.trapexit.org/How_to_use_ei_to_marshal_binary_terms_in_port_programs

I've got it working as posted. But now I want to pass an array to c. I assume it's best to pass it as a list. How to handle the c driver side to read in the elements of the list into a c array?

Can anyone help?

Thanks in advance
Risky
View user's profile Send private message
riskyrisk
Posted: Thu Oct 23, 2008 6:28 pm Reply with quote
Joined: 11 Oct 2008 Posts: 8 Location: Netherlands
To help illustrate:

What I'd like to do is this
>port:start().

>port:price(1,2,0,100,100,0.05,1,0.3,50,3,[2.3,4,6],[1.1,1.4,2],1).

So it's a mix of ints and doubles. Also the list of doubles. I know I'd have to handle the case if my list of double looked like a erlang string.

Thanks to the article posted here I've got it working for the doubles and ints. Running into troubles trying to get it to see the list as an array...
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum