4 May 2012 19:22
Wrap an array of structs to ruby
Johann Nagel <yngad <at> web.de>
2012-05-04 17:22:15 GMT
2012-05-04 17:22:15 GMT
I want to wrap a library Function writen in C to ruby which contains an array of structs.
I adopted %array_class(double, doubleArray); from http://www.swig.org/Doc2.0/Library.html#Library_carrays
interface file:
%array_class(Param , ParamArray);
typedef struct Param Param
extern int ep_authorization(Param pa[]);
ruby:
pa = Epayment::ParamArray.new(10)
p = Epayment::Param.new
p.name = "module"
p.value = "x"
pa[0] = p
Epayment.ep_authorization(pa)
I get this error message:
Expected argument 1 of type Param [], but got Epayment::ParamArray
Perhaps there is an obvious solution for this, but I am new to swig and couldn't find a solution for this either in the doku nor in the archives.
Thanks for any hints
I adopted %array_class(double, doubleArray); from http://www.swig.org/Doc2.0/Library.html#Library_carrays
interface file:
%array_class(Param , ParamArray);
typedef struct Param Param
extern int ep_authorization(Param pa[]);
ruby:
pa = Epayment::ParamArray.new(10)
p = Epayment::Param.new
p.name = "module"
p.value = "x"
pa[0] = p
Epayment.ep_authorization(pa)
I get this error message:
Expected argument 1 of type Param [], but got Epayment::ParamArray
Perhaps there is an obvious solution for this, but I am new to swig and couldn't find a solution for this either in the doku nor in the archives.
Thanks for any hints
| Ihr WEB.DE Postfach immer dabei: die kostenlose WEB.DE Mail App für iPhone und Android. https://produkte.web.de/freemail_mobile_startseite/ |
------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________ Swig-user mailing list Swig-user <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/swig-user
RSS Feed