.def的问题
小弟我写了一个dll给其它语言调用,尽出现:Cannot find the entry point Add in the dll的错误.
myDll.cpp 代码如下:
#include "stdafx.h"
#include "MathFuncsDll.h"
#include <stdexcept>
#include <iostream>
#include <windows.h>
using namespace std ;
namespace matchFuncs
{
int myMatchfunc::Add(int a,int b)
{
return a+b ;
}
double myMatchfunc::Subtract(double a,double b)
{
return a-b ;
}
double myMatchfunc::Mutiply(double a,double b)
{
return a*b ;
}
double myMatchfunc::Divide(double a,double b)
{
if (b == 0)
{
throw new invalid_argument("b cannot be zero!");
}
return a/b ;
}
}
mydll.h代码如下:
namespace matchFuncs
{
class myMatchfunc
{ public :
//Return a+b
static _declspec(dllexport) int Add(int a ,int b);
//Return a-b
static _declspec(dllexport) double Subtract(double a ,double b);
//Return a*b
static _declspec(dllexport) double Mutiply(double a ,double b);
//Return a/b
static _declspec(dllexport) double Divide(double a ,double b);
};
}
请问dll中的函数(Add,Subtract等)还要在.def中声明吗?