Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
odygrd committed Sep 23, 2024
1 parent 22c5ba8 commit a731232
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ extern "C"

run_test_module();

// Always stop logger at the end
stop_quill();

// Simulate work with modules, then release
FreeLibrary(testModule);

// Always stop logger at the end
stop_quill();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,25 @@

QUILL_EXPORT extern quill::Logger* global_logger_a;

BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
// Code to run when the DLL is loaded
break;
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
// Code to run when a thread is created or destroyed
break;
case DLL_PROCESS_DETACH:
// Code to run when the DLL is unloaded
global_logger_a->flush_log();
break;
}
return TRUE; // Successfully processed
}

extern "C"
{
void run_test_module() { LOG_INFO(global_logger_a, "TestModule is running"); }
Expand Down

0 comments on commit a731232

Please sign in to comment.