D
di vi
Hi,
I have a C++ code converted into a windows Dll.I want to use Ruby /DL to
invoke the functions in the DLL.
Here are the function prototypes:
C++ code
Ruby code
Gives me an error saying undefined symbol.
I have a C++ code converted into a windows Dll.I want to use Ruby /DL to
invoke the functions in the DLL.
Here are the function prototypes:
C++ code
Code:
// MathFuncsDll.h
namespace MathFuncs
{
class MyMathFuncs
{
public:
// Returns a + b
static __declspec(dllexport) double Add(double a, double b);
// Returns a - b
static __declspec(dllexport) double Subtract(double a, double
b);
// Returns a * b
static __declspec(dllexport) double Multiply(double a, double
b);
// Returns a / b
// Throws DivideByZeroException if b is 0
static __declspec(dllexport) double Divide(double a, double b);
};
}
Ruby code
Code:
require 'dl/import'
module MATHFUN
extend DL::Importable
dlload "math funcs.dll"
extern "double Add(double a, double b)"
#extern "int strlen(const char *)"
end
MATHFUN.Add(5,4)
Gives me an error saying undefined symbol.