class pointer dll.txt
The way to create dll with c++ class in Dev c++
reference :
www.ragestorm.net/snippet?id=25
www.codeproject.com/KB/DLL/classesexportedusingLL.aspx
hp.vector.co.jp/authors/VA041250/doc/plugin/
www.daniweb.com/forums/thread208629.html#
//class1.h
#ifndef _DLL_H_
#define _DLL_H_
#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */
class Class1
{
private:
public:
Class1();
virtual int add(int,int);
virtual int sub(int,int);
virtual ~Class1(); // Yes, dtor can(and should) be a virtual too!
};
#endif /* _DLL_H_ */
//class1.cpp
/* Replace "dll.h" with the name of your header */
#include "class1.h"
#include
#include
Class1::Class1()
{
}
int Class1::add(int i,int j)
{
return (i+j);
第 1 页
class pointer dll.txt
}
int Class1::sub(int i,int j)
{
return (i-j);
}
Class1::~Class1()
{
}
extern "C" __declspec(dllexport) Class1* MakeClass1Ptr()
{
return new Class1();
}
//mainloaddll.cpp
#include "class1.h" // You'll have to include it, in order to know how the class
is built!
#include
using namespace std;
int main()
{
HMODULE hDLL = LoadLibrary("Class.dll"); // Loading DLL
if (hDLL == NULL)
{
cout<<"failed to load library"<>i;
cout<<"plz input another integer : ";
cin>>j;
第 2 页
class pointer dll.txt
cout<<"the sum is "<add(i,j)<sub(i,j)<
本文档为【create dll by c++ class】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。