logging not working for windows dll

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
rakeshd
Posts: 11
Joined: Wed, 2014-01-15, 08:43
Location: South Korea

logging not working for windows dll

#1 Post by rakeshd »

Hi
The following code we are calling from the main in our application (MWLSCU.exe).

Code: Select all

        OFConsoleApplication app(OFFIS_CONSOLE_APPLICATION, "Application", rcsid);
	OFCommandLine cmd;
	OFLog::addOptions(cmd);
	app.parseCommandLine(cmd, argc, argv);
	OFLog::configureFromCommandLine(cmd, app);
However the DCMTK libraries are used in a separate application library (MWLSCU.dll).
We noticed that the DCMTK doesn't log any message in this case.

But it logs if we build MWLSCU as static library or initialize the logger in the DLL itself (which we dont prefer).


Please suggest a solution.

Thanks

Jan Schlamelcher
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 318
Joined: Mon, 2014-03-03, 09:51
Location: Oldenburg, Germany

Re: logging not working for windows dll

#2 Post by Jan Schlamelcher »

Hi rakeshd

I expect that the DLL has its own instance of the logger, therefore configuring it in the executable doesn't help it. I just had a look at the respective code, but it seems that changing it so that you may use the instance form the DLL instead is not an easy task, as it is quite fragmented. I suggest writing a wrapper-method for OFLog::configureFromCommandLine(...) that your DLL exports, so that it may be called from the application effectively configuring the logger inside the DLL, but still via the command line parameters given to the application.

EDIT: I just had another idea: did you try to build DCMTK as a set of DLLs? Maybe, if the logger is inside its own DLL, it will always have its own instance inside that DLL, no matter where it is initialized from.

Regards
Jan

rakeshd
Posts: 11
Joined: Wed, 2014-01-15, 08:43
Location: South Korea

Re: logging not working for windows dll

#3 Post by rakeshd »

Hi Jan,
Thank you so much for your reply.

Yes, we tried with building DCMTK as DLLs and it works in this scenario.


Thanks

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest