请教高手:如何从一个MFC扩展DLL中倒出函数?
我的具体步骤如下:
1。首先通过MFC DLL向导生成模板
2。加入对话框资源及类声明
3。建立倒出文件:MyExport.h ,MyExport.cpp
其中在MyExport.h中定义了一个函数:
const char* AFX_EXT_API GetDlg()//用于打开对话框
如果将MyExport.h ,MyExport.cpp从DLL工程中移去则编译通过,将MyExport.h ,MyExport.cpp加入工程则提示如下错误:
e:\dlltest\dlgext\atomdlg.h(157) : warning C4518: '__declspec(dllexport ) ' : storage-class or type specifier(s) unexpected here; ignored
e:\dlltest\dlgext\atomdlg.h(166) : warning C4518: '__declspec(dllexport ) ' : storage-class or type specifier(s) unexpected here; ignored
Generating Code...
Linking...
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in DlgExt.obj
mfcs42d.lib(dllmodul.obj) : error LNK2005: __pRawDllMain already defined in DlgExt.obj
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in DlgExt.obj; second definition ignored
mfcs42d.lib(dllmodul.obj) : warning LNK4006: __pRawDllMain already defined in DlgExt.obj; second definition ignored
Creating library Debug/DlgExt.lib and object Debug/DlgExt.exp
Debug/DlgExt.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
不知道待倒出的函数应该在何处声明,请各位高手帮忙。谢谢!