From: di vi Date: 2010-02-11T00:10:20+09:00 Subject: Using Ruby /DL to invoke function in windows dll 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 [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); }; } [/code] 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) [/code] Gives me an error saying undefined symbol. -- Posted via http://www.ruby-forum.com/.