R
ROTH Jakub
How does one declare and external function (in a DLL) for use with Ruby
which requires doubles as parameters and likewise returns double as a
result? Is there any good detailed doc/info on the web on this?
I have a C fct declared as
double jadd2( double a, double b )
and export it from a DLL it gets compiled into. I want to call it from Ruby.
Import it into Ruby as:
jadd2 = Win32API.new('jadd.dll', 'jadd2', 'dd', 'd')
and call as
p jadd2.Call( 1.3, 2.4 )
the error is "in `Call': Wrong number of parameters: expected 0, got 2.
(RuntimeError)"
However, a similar fct declared as short jadd(short a, short b) and imported
into Ruby with 'II', 'I' as the Win32API.new import and export parameters
works just fine!
What am I missing?
Thanks,
--Jakub Roth
which requires doubles as parameters and likewise returns double as a
result? Is there any good detailed doc/info on the web on this?
I have a C fct declared as
double jadd2( double a, double b )
and export it from a DLL it gets compiled into. I want to call it from Ruby.
Import it into Ruby as:
jadd2 = Win32API.new('jadd.dll', 'jadd2', 'dd', 'd')
and call as
p jadd2.Call( 1.3, 2.4 )
the error is "in `Call': Wrong number of parameters: expected 0, got 2.
(RuntimeError)"
However, a similar fct declared as short jadd(short a, short b) and imported
into Ruby with 'II', 'I' as the Win32API.new import and export parameters
works just fine!
What am I missing?
Thanks,
--Jakub Roth