grazie Shodan.
il mio problema adesso è questo:
ho inserito le interfacce nel seguente file:
codice:
class CBeamDSChess;
class CEntityDS;
#include "stdafx.h"
#include "Factory1.h"
#include <map>
class CBeamDSChess;
class CEntityDS;
typedef CEntityDS* (*BASE_CREATE_FN)();
class CFactory1Impl : public CFactory1
{
public:
CFactory1Impl(void) {}
~CFactory1Impl(void) {}
static bool InizializedMap;
static CFactory1Impl* instance_ptr ;
static CFactory1Impl* get_instance() {
if (instance_ptr == NULL) {
instance_ptr = new CFactory1Impl();
}
return instance_ptr;
}
CEntityDS * CreateDS( int idOfObjectToCreate );
std::map<int, BASE_CREATE_FN> m_pMapRegister;
};
CFactory1Impl* CFactory1Impl::instance_ptr;
CEntityDS* CFactory1Impl::CreateDS( int idOfObjectToCreate ) {
BASE_CREATE_FN fz = m_pMapRegister[0] = CBeamDSChess::instance;
return fz();
return 0;
}
extern "C" {
__declspec(dllexport)CFactory1* FactoryDS() {
CFactory1Impl::m_pMapRegister[0] = CBeamDSChess::instance;
return CFactory1Impl::instance_ptr;
}
}
nel .h:
codice:
#pragma once
class CEntityDS;// classe interfaccia.
class CFactory1
{
public:
virtual CEntityDS * CreateDS( int idOfObjectToCreate );
};
extern "C" {
__declspec(dllexport)CFactory1* FactoryDS();
}
l'errore è questo:
c:\testdatasetcmpimportapi\CmpFrg\Factory1.cpp(32) : error C2065: 'instance' : undeclared identifier
c:\testdatasetcmpimportapi\CmpFrg\Factory1.cpp(32) : error C2027: use of undefined type 'CBeamDSChess'
pardon , nel file CBeamDSChess ho una funzione statica
static CEntityDS* instance(){return new CBeamDSChess();}
il casino puo essere nato dal fatto che la mia classe ase è CEntityDS e le derivate derivano da questa, anche CBeamDSChess.
grazie ancora