djsohrab2007
یک شنبه 06 شهریور 1390, 03:43 صبح
اولین باره که به یه همچین مشکل می خورم :خجالت: نمی دونم واللا تا الان همینجوری کد می نوشتم و مشکل هم ایجاد نمی شد، اما حالا !!!!!!!
لطف کنید بگید چرا این کد اجرا نمی شه ؟
فایل .h
#pragma once
#ifdef DLL_EXPORT
#define DECLDIR __declspec(dllexport)
#else
#define DECLDIR __declspec(dllimport)
#endif
namespace Dll
{
class Interface
{
public:
virtual void Function1( int ) ;
virtual int Function2 ( void ) ;
virtual void Deletethis();
virtual ~Interface();
};
class Implemention : public Interface
{
public:
virtual void Function1 ( int );
virtual int Function2 ( void ) ;
virtual void Deletethis() ;
};
}
extern "C" DECLDIR Dll::Interface* CreatInstance ();
فایل .cpp
#include"testDLL2.h"
#include<iostream>
using namespace std;
using namespace Dll;
#define DLL_EXPORT
void Implemention::Function1( int a )
{
cout<<a<<endl;
}
int Implemention::Function2( void )
{
return 0 ;
}
void Implemention::Deletethis()
{
delete this;
}
Interface::~Interface()
{
}
extern "C" Dll::Interface* CreatInstance ()
{
return ( new Implemention ) ;
}
اینم از اروری که میده :
74488
لطف کنید بگید چرا این کد اجرا نمی شه ؟
فایل .h
#pragma once
#ifdef DLL_EXPORT
#define DECLDIR __declspec(dllexport)
#else
#define DECLDIR __declspec(dllimport)
#endif
namespace Dll
{
class Interface
{
public:
virtual void Function1( int ) ;
virtual int Function2 ( void ) ;
virtual void Deletethis();
virtual ~Interface();
};
class Implemention : public Interface
{
public:
virtual void Function1 ( int );
virtual int Function2 ( void ) ;
virtual void Deletethis() ;
};
}
extern "C" DECLDIR Dll::Interface* CreatInstance ();
فایل .cpp
#include"testDLL2.h"
#include<iostream>
using namespace std;
using namespace Dll;
#define DLL_EXPORT
void Implemention::Function1( int a )
{
cout<<a<<endl;
}
int Implemention::Function2( void )
{
return 0 ;
}
void Implemention::Deletethis()
{
delete this;
}
Interface::~Interface()
{
}
extern "C" Dll::Interface* CreatInstance ()
{
return ( new Implemention ) ;
}
اینم از اروری که میده :
74488