R
Robert Klemme
your example generates code looks like this:
params =3D x1, x2, x3, x4
But with that I get an error (eval):3:in `+': can't convert Fixnum
into String (TypeError)
Without the code you are executing that error is pretty useless.
It works for me:
irb(main):023:0> STUB_CALLS=3Dfalse
(irb):23: warning: already initialized constant STUB_CALLS
=3D> false
irb(main):024:0> GET_VALUE "f", "m", "r", 4
def f(x0, x1, x2, x3)
oai =3D OA.instance
handle =3D oai.getWIN32OLEHandle()
handle.call(['MethodNameIn','Params'],['m', [x0, x1, x2, x3]]);
ret_val =3D handle.GetControlValue(r);
error =3D handle.GetControlValue('error out');
return oai.checkForError(error) ? 'NaN': ret_val
end
=3D> nil
irb(main):025:0> STUB_CALLS=3Dtrue
(irb):25: warning: already initialized constant STUB_CALLS
=3D> true
irb(main):026:0> GET_VALUE "f", "m", "r", 4
def f(x0, x1, x2, x3)
printf("Calling m(x0, x1, x2, x3) with parameters <%p>\n", [x0, x1, x2, x3]=
)
end
=3D> nil
irb(main):027:0>
(with my definition of GET_VALUE from earlier)
Yes, I could use this, but still I need to assembly this line since I
dont know the number of input parameters at coding time. And I know
that no input parameters contain any expressions that needs to be
evaluated since it is an input from my generated function.
I find the solution with printf "%p" and the Array more elegant.
Cheers
robert
--=20
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/