log4cplus: crash on Logger::shutdown on Windows

857 views Asked by At

When I call

log4cplus::Logger::shutdown();

it throws an exception Invalid address specified to RtlFreeHeap( 02BF0000, 02B71170 ) on deconstructors of log4cplus's classes.

I'm using log4cpp 1.2.x (from current 1.2.x branch) and Visual Studio 2010 SP1. I compiled my application to work on Win32 architecture, but it crashes when compiled for x64, too. I created log4cplus as an DLL file and added the log4cplus.lib file as additional dependency to my application to link it load-time. I have some other DLL files which are run-time dynamically loaded into the application. The run-time loaded DLLs also depend on log4cplus.

log4cplus's logging system is initialized as early as possible to support logging in every stage of my application (as first call in the main method).

Is it an issue with mixing load-time and run-time loaded DLL files?

PS: I have some basic knowledge about C++ programming.

edit:

OS: Windows 8.1 x64

Application type:

  • GUI application over WinAPI (custom preloader, update mechanism and user login)
  • native calling jvm.dll to create a JavaVM (main application after user logged in, is written in Java)

It runs into an exception at after calling PatternLayout::~PatternLayout() before creating a JavaVM.

edit2:

The structure of my project solution is:

  • app (executable)
  • xcom (dll library for communication with Java)
  • systemgtk (dll library for registry access and GUI)
  • service (executable, background updater, runs as Windows service)
  • log4cplus

The projects app, xcom, systemgtk and serivce loads log4cplus at init time, systemgtk and xcom are loaded at run time inside the app and service.

I initialize log4cplus in the app.exe and want to close it inside the systemgtk.dll.

edit3:

Okay, it seems to be a build configuration issue. I don't know how, but I fixed this issue.

1

There are 1 answers

0
keekeeBB On

I found that in the "Configuration Properties->General" panel if "Use of MFC" is set to "Use MFC in a Shared DLL", the error will be gone; but if it's set to "Use MFC in a Static Library", the error will show up.