Pantheios enters C ++ DLL

Here is the scenario:

I have testApp.cppone that has a function main. And this one testApp.cppuses libraries misc.dlland common.dll.

I would like to create a log for the file, not for the console.

So, in the function, testApp.cpp main()I use the following:

pantheios::pantheios_init();
pantheios_be_file_setFilePath("mylogfile.log");
pantheios::log_NOTICE(" START TESTAPP");

// Call function from misc.dll and common.dll
pantheios::log_NOTICE(" END TESTAPP ");
pantheios_be_file_setFilePath(NULL);

This will create a file mylogfile.logwith the contents of "START TESTAPP"

NOW PROBLEM:

I would also like to add logging from misc.dll and common.dll to mylogfile.log. In other words, if I add log testMiscfunction()to the misc.dll file, I would like this log out testMiscfunction()to write to the mylogfile.log file. And, of course, the same with common.dll.

Now here is a sample dll entry for misc.dll

#include "pantheios/pantheios.hpp" 
#include "pantheios/backends/bec.file.h" 
#include "pantheios/implicit_link/core.h"
#include "pantheios/implicit_link/be.file.h"

extern "C" const char PANTHEIOS_FE_PROCESS_IDENTITY[] = "MISC_DLL"; 

BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
            )
{
    switch (ul_reason_for_call)
    {
        case DLL_PROCESS_ATTACH:
            pantheios::pantheios_init();
            break;

        case DLL_THREAD_ATTACH:
            break;


        case DLL_THREAD_DETACH:
            break;


        case DLL_PROCESS_DETACH:
            pantheios::pantheios_uninit();
            break;
    }
    return TRUE;

}

So now in

testMiscFunction() { pantheios::log_NOTICE("I am testMiscFunction"); } 

, " testMiscFunction" mylogfile.txt. : ? .

....

+3
1

DLL Pantheios, . init/uninit Pantheios DLL (, , ).

+1

Source: https://habr.com/ru/post/1787822/


All Articles