收录查询

Foo MFC(1)

VC2.0(搭配MFC3.0)的时候需要通过“手工指定”连接什么import library,那时还没有default import library

现在不用了,M$已经把这些工作放到了*.h文件中,通过“预编译宏/伪指令”实现了它们,如:(VC6.0中)

不过有的库还是要通过手工进行设置

AFX.H 头文件中实现了一些用来指定LINKER去连接具体库的代码,MFC框架的 NAFXCWD.LIB或NAFXCW.LIB , 并对是否是DEBUG版本的库做出判断:

...
#ifndef _UNICODE                                 //ASCII版本
    #ifdef _DEBUG
        #pragma comment(lib, "nafxcwd.lib")
    #else
        #pragma comment(lib, "nafxcw.lib")
    #endif
#else                                           //unicode版本
    #ifdef _DEBUG
        #pragma comment(lib, "uafxcwd.lib")
    #else
        #pragma comment(lib, "uafxcw.lib")
    #endif
#endif...





顺便说下:上面的在*.h头文件中指定的都是需要被动态连接到应用程序中的DLL所对应的import library。
====================================================================================
DLLs: Overview




A dynamic-link library (DLL) is an executable file that acts as a shared library of functions.
Dynamic linking provides a way for a process to call a function that is not part of its
executable code. The executable code for the function is located in a DLL, which contains one or more
functions that are compiled, linked, and stored separately from the processes that use
them. DLLs also facilitate the sharing of data and resources. Multiple applications can
simultaneously access the contents of a single copy of a DLL in memory.

Dynamic linking differs from static linking in that it allows an executable module (either a .DLL or .EXE file) to include only the information needed at run time to locate the executable code for a DLL function. In static linking, the linker gets all the referenced functions from the static link library and places it with your code into your executable. Using DLLs instead of static link libraries makes the size of the executable file smaller. If several applications use the same DLL, this can be a big savings in disk space and memory.

posted @ 2006-01-08 17:02  ->  阅读(213)  评论(0)    收藏  举报