我将程序中一个函数写成了 dll,我是通过LoadLibrary来加载的,调用问dll中的函数后使用FreeLibrary进行释放。
我想知道每次释放后,再加载时,是否相当于将程序关闭了,重新运行程序。

解决方案 »

  1.   

    No .DLLs and Memory ManagementEvery process that loads the DLL maps it into its virtual address space. After the process loads the DLL into its virtual address, it can call the exported DLL functions.The system maintains a per-thread reference count for each DLL. When a thread loads the DLL, the reference count is incremented by one. When the process terminates, or when the reference count becomes zero (run-time dynamic linking only), the DLL is unloaded from the virtual address space of the process.Like any other function, an exported DLL function runs in the context of the thread that calls it. Therefore, the following conditions apply:
    The threads of the process that called the DLL can use handles opened by a DLL function. Similarly, handles opened by any thread of the calling process can be used in the DLL function. 
    The DLL uses the stack of the calling thread and the virtual address space of the calling process. 
    The DLL allocates memory from the virtual address space of the calling process.