1.做dll的时候,win32和mfc两种有什么区别?这两种方法做的dll都能支持语言无关性吗?
2.怎样在我的exe里面使用dll?包括导入方式
3.windows的dll调用是如何实现的?即windows的api函数的实现实在dll里面,但是调用的时候只需要导入.lib文件和头文件即可,这是怎样实现的?

解决方案 »

  1.   

    See the link below, FYI:http://www.codeproject.com/dll/and u can get more via MSDNjust paste a snippet: 
    DLLs: Overview
    Home |  How Do I |  FAQ |  Details |  SampleA 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.What do you want to do?
    Export from a DLL
    Link an executable to a DLL
    Initialize a DLL 
    What do you want to know more about?
    The advantages of using DLLs
    The different kinds of DLLs available with Visual C++
    Non-MFC DLLs: Overview
    Regular DLLs statically linked to MFC: Overview
    Regular DLLs dynamically linked to MFC: Overview
    Extension DLLs: Overview
    Which kind of DLL to use 
      

  2.   

    1。mfc是半成品,使用简单,生成的代码较大,平台敏感
    3。静态连接
      

  3.   

    我的理解1: 基本相同,DLL和EXE类似,不过它更象一个库,只要是32位的就应该可以,当然16(DOS)就不可以了。
    2:使用DLL包括显示连接和隐示连接。
    3:用LIB是隐示连接,方法简单,只要把LIB和CPP文件放到一起,而再加上头文件(声明DLL函数)就可以调用了,
    显示连接如下:
    //--定义“实例”
     HINSTANCE Dll_handler;//--声明dll内的函数
    typedef BOOL (*DLLTEST)(int nPort, int nBaud, int nByte, int nParity);
    DLLTEST CommOpen;;
    //--装载dll
    Dll_handler = LoadLibrary("Commpro.dll"); CommOpen = (DLLTEST)GetProcAddress(Dll_handler,"CommOpen");//--取得dll中的函数地址
    CommOpen(m_nPort,m_nBaud,m_nByte,m_nParity)
    FreeLibrary(Dll_handler);