为什么静态链接MFC库后AfxLoadLibrary变成未定义的了?

SBDCW 2005-06-02 01:46:48
为什么工程在静态链接MFC库后AfxLoadLibrary变成未定义的了?而动态链接MFC库则没有问题。动态链接接MFC库和静态链接在代码上的区别有哪些?谢谢各位了!!
...全文
231 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xwzxwz 2005-06-02
  • 打赏
  • 举报
回复
你用win32sdk的LoadLibrary和FreeLibrary代替不就行了么.....

参数和返回值都一样的
DentistryDoctor 2005-06-02
  • 打赏
  • 举报
回复
AfxLoadLibrary定义在afxdll_.h中,同时你看看Afxdll_;h

// This is a part of the Microsoft Foundation Classes C++ library.
// Copyright (C) Microsoft Corporation
// All rights reserved.
//
// This source code is only intended as a supplement to the
// Microsoft Foundation Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding the
// Microsoft Foundation Classes product.

// afxdll_.h - extensions to AFXWIN.H used for the 'AFXDLL' version
// This file contains MFC library implementation details as well
// as APIs for writing MFC Extension DLLs.
// Please refer to Technical Note 033 (TN033) for more details.

/////////////////////////////////////////////////////////////////////////////

#ifndef _AFXDLL
#error file must be compiled with _AFXDLL
#endif


说明如果是在静态库中使用MFC,根本就不会包含此文件,同时也根本不能包含此文件,所以。。。
dongfa 2005-06-02
  • 打赏
  • 举报
回复
使用LoadLibrary不就可以了吗?

mfc源程序

// special functions for loading and freeing MFC extension DLLs
// (necessary if your app is multithreaded and loads extension
// DLLs dynamically)
HINSTANCE AFXAPI AfxLoadLibrary(LPCTSTR lpszModuleName);
BOOL AFXAPI AfxFreeLibrary(HINSTANCE hInstLib);

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧