简体   繁体   中英

How to get log by using logog in DLL API's in C++

How to write log inside DLL API?

In my program I am using two threads with one main thread. I am initializing:

LOGOG_INITIALIZE();

logog::LogFile errFile("log.txt");

Into my main thread and using INFO , ERR in main thread other two threads. My main thread is using C++ DLL API's. I am perfectly getting log from main thread and two other running thread but my problem is I am not able to get log from DLL API's flow. How to get log by using logog in DLL API's. I would like to clear here if I am using INFO in DLL API. it is crashing but if I do LOGOG_INITIALIZE(); inside DLL API, INFO executes but does not log anything.

If i get it correct, your situation is as follows: You have, for example, one application (EXE) which uses a shared library (DLL). From both, the EXE and the DLL, you want to be able to log.

Last time i checked out the logog library i run in problems with the situation described above. Maybe now it is corrected?

Under windows (only!), the logog library doesn't export any symbols - it is simply not ready to be used as DLL. This forces you to build and use logog as static library - which leads to problems with static variables inside the logog library which should exist only once, but in reality are existing as many times as the static library was linked to a module (EXE or DLL).

The solution would be to build and use the logog library as DLL.

Maybe this covers your problem and you may take the effort to export the symbols of the logog library. Or you could get in contact with the library writer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM