那位高手能帮忙解决一下 如何在DLL中封装一个类 然后在MFC中将类导出
解决方案 »
- 求教windows编程
- IOCP的UDP服务器如何控制发送速度。
- 在对话框里如何使绘制的图形缩放
- 在WIN32 Dynamic-Link Library建了一个工程,为什么在里面不能用CTime类,请高手指教!!!!
- 文档/视图框架中APP中有默认打开文件的消息映射,就是没有函数体, 我如何修改?
- VC中一COM函数返回是BSTR型在VB方用什么类型能接受啊。。急啊。
- 谁知道Clob所对应的SQL数据类型?
- 一个奇怪的问题,熟悉VS2010IDE的大神给解答一下
- 关于屏幕坐标旋转的问题
- 各位大虾帮忙阿!关于调试的!
- 小弟初学,又没有VC/MFC的QQ讨论群阿?
- VC的API和VB的API和JAVA的API都是一样的吗!!!谁知道啊!!!!
__declspec(dllexport) void __cdecl Function1(void);
To export all of the public data members and member functions in a class, the keyword must appear to the left of the class name as follows: Copy Code
class __declspec(dllexport) CExampleExport : public CObject
{ ... class definition ... };
When building your DLL, you typically create a header file that contains the function prototypes and/or classes you are exporting and add __declspec(dllexport) to the declarations in the header file. To make your code more readable, define a macro for __declspec(dllexport) and use the macro with each symbol you are exporting: Copy Code
#define DllExport __declspec( dllexport )
__declspec(dllexport) stores function names in the DLL's export table. If you want to optimize the table's size, see Exporting Functions from a DLL by Ordinal Rather Than by Name.Note
When porting DLL source code from Win16 to Win32, replace each instance of __export with __declspec(dllexport).
As a reference, search through the Win32 Winbase.h header file. It contains examples of __declspec(dllimport) usage.
这个类就可以导出了