我有一个像这样的简单函数:
cusp.dll
#define EXPORT extern "C" __declspec (dllexport)
EXPORT
void cuspDsolver(int *r, int *c, double *v, double *x, double *b, int size, int nnz,double tol)
{
.
.
.
.
.
}
Run Code Online (Sandbox Code Playgroud)
我用这两行创建了一个dll:
#define EXPORT extern "C" __declspec (dllexport)
EXPORT
Run Code Online (Sandbox Code Playgroud)
我使用这种方法在其他Project中调用了这个函数:
HINSTANCE hDLL = LoadLibrary("C:\\Users\\Administrator\\Documents\\Visual Studio 2012\\Projects\\Ardalan_12\\cusp.dll");
if(hDLL == NULL)
{
cout<< "Failed to load DLL" <<endl;
}
typedef void(*fnPtr)(int *, int *, double *, double *, double *, int , int ,double);
fnPtr pfn;
pfn=(fnPtr)GetProcAddress(hDLL,"cuspDsolver");
if(pfn)
{
pfn(rowOffset,colIndex,values,answer,rightHandSide,theSize,nnz,0.9);
} …Run Code Online (Sandbox Code Playgroud) 我有一个抽象类element和一个子类elasticFrame:
class element
{
public:
virtual Matrix getStiffness() = 0;
protected:
Matrix K;
};
class elasticFrame3d:public element
{
public:
elasticFrame3d(double E, double G);
virtual Matrix getStiffness();
virtual Matrix getTransform();
private:
double E, G;
};
Run Code Online (Sandbox Code Playgroud)
我想要做的是这样的地图:
map<int, element> elementMap;
Run Code Online (Sandbox Code Playgroud)
但是当我收到此错误时:
error C2259: 'element' : cannot instantiate abstract class
Run Code Online (Sandbox Code Playgroud)
甚至有可能做到这一点?如果是,怎么办?