Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?
Гродненский Форум
25 Июль 2025, 05:02:28
Новости, реклама:
   Главная   Новости Гродно Помощь Игры Календарь Войти Регистрация   Меню
Страниц  :   Вниз
  Печать  
Автор Тема: Re: С++. Нужны ответы, наверное на элементарные во  (Прочитано 1120 раз)
0 Пользователей и 1 Гость смотрят эту тему.
VooDoo
Почетный гродненец
*****

Репутация: +89/-1
Offline Offline

Пол: Мужской
Сообщений: 2885


Dum spiro spero

Просмотр профиля WWW Email
« Ответ #0 : 14 Август 2008, 13:49:20 »

The DLL entry point
When you create a DLL, you can optionally specify an entry point function. The entry point function is called when processes or threads attach themselves to the DLL or detached themselves from the DLL. You can use the entry point function to initialize data structures or to destroy data structures as required by the DLL. Additionally, if the application is multithreaded, you can use thread local storage (TLS) to allocate memory that is private to each thread in the entry point function. The following code is an example of the DLL entry point function.
Код:
BOOL APIENTRY DllMain(
HANDLE hModule,      // Handle to DLL module
      DWORD ul_reason_for_call,      // Reason for calling function
      LPVOID lpReserved ) // Reserved
{
      switch ( ul_reason_for_call )
      {
            case DLL_PROCESS_ATTACHED:
            // A process is loading the DLL.
            break;
            case DLL_THREAD_ATTACHED:
            // A process is creating a new thread.
            break;
            case DLL_THREAD_DETACH:
            // A thread exits normally.
            break;
            case DLL_PROCESS_DETACH:
            // A process unloads the DLL.
            break;
      }
      return TRUE;
}
When the entry point function returns a FALSE value, the application will not start if you are using load-time dynamic linking. If you are using run-time dynamic linking, only the individual DLL will not load.

The entry point function should only perform simple initialization tasks and should not call any other DLL loading or termination functions. For example, in the entry point function, you should not directly or indirectly call the LoadLibrary function or the LoadLibraryEx function. Additionally, you should not call the FreeLibrary function when the process is terminating.

Note In multithreaded applications, make sure that access to the DLL global data is synchronized (thread safe) to avoid possible data corruption. To do this, use TLS to provide unique data for each thread.
Записан

Are you human? - My body is.
Do you feel pain? - My body does.
..- --- --- -.. --- ---
Страниц  :   Вверх
  Печать  
 
Перейти в:  

Войти
Войдите, чтобы добавить комментарий

Войдите через социальную сеть

Имя пользователя:
Пароль:
Продолжительность сессии (в минутах):
Запомнить:
Забыли пароль?

Контакт
Powered by MySQL Powered by PHP Мобильная версия
Powered by SMF 1.1.20
SMF © 2006-2025, Simple Machines
Simple Audio Video Embedder
| Sitemap
Valid XHTML 1.0! Valid CSS!
Страница сгенерирована за 0,17 секунд. Запросов: 19.