Hi i've been trying to make RPG Maker XP access an external dll's method using the following:
The dll file is in the same folder as Game.exe
Is was a tutorial i found written in VC++
and
I get the error:
Runtime error
GetProcAddress: Add or AddA
This has been driving me nuts for days now. Any help would be great.
Code:
@read = Win32API.new 'MathFuncsDll', 'Add',['i','i'], 'i'
The dll file is in the same folder as Game.exe
Is was a tutorial i found written in VC++
Code:
// MathFuncsDll.cpp
// compile with: /EHsc /LD
#include "MathFuncsDll.h"
#include <stdexcept>
using namespace std;
namespace MathFuncs
{
int MyMathFuncs::Add(int a, int b)
{
return a + b;
}
int MyMathFuncs::Subtract(int a, int b)
{
return a - b;
}
int MyMathFuncs::Multiply(int a, int b)
{
return a * b;
}
int MyMathFuncs::Divide(int a, int b)
{
if (b == 0)
{
throw new invalid_argument("b cannot be zero!");
}
return a / b;
}
}
and
Code:
// MathFuncsDll.h
namespace MathFuncs
{
class MyMathFuncs
{
public:
// Returns a + b
static __declspec(dllexport) int Add(int a, int b);
// Returns a - b
static __declspec(dllexport) int Subtract(int a, int b);
// Returns a * b
static __declspec(dllexport) int Multiply(int a, int b);
// Returns a / b
// Throws DivideByZeroException if b is 0
static __declspec(dllexport) int Divide(int a, int b);
};
}
I get the error:
Runtime error
GetProcAddress: Add or AddA
This has been driving me nuts for days now. Any help would be great.