#1 2018-02-11 15:14:08

xiwuping
Member
Registered: 2018-02-11
Posts: 32

TSynLog for a DLL

I am developing a DLL for a third-party Host Executable (that I have no control and no access the its C++ source code).

QUESTION 1:

I used TSynLog to generate logging for my DLL.  I also generated MAP file for the DLL.  How can I use the MAP file correctly for my DLL, so the log can show line numbers?

QUESTION 2:

The hosting executable use LoadLibrary to load my DLL.

Inside my DLL, I use LOG_VERBOSE,  which include Exception and ExceptionOS.  I also put the line ExceptionIgnore.Add(EExternalException);

However,  the hosting executable always crashes when closing with LOG_VERBOSE.  The hosting executable works fine if I remove sllException and sllExceptionOS.  One exception I caught from host executable was   
DBG_PRINTEXCEPTION_C (0x40010006)

So,  any advice,  on the CORRECT way to use TSynlog, in a DLL?

Thank you.
xiwu

Offline

#2 2018-02-11 15:24:53

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,700
Website

Re: TSynLog for a DLL

1. Generate the .mab file from the .map file and append it to the .dll

2. Enable exception logging only once for the whole executable, i.e. only for the main .exe not the .dll.

Offline

#3 2018-02-11 16:26:01

xiwuping
Member
Registered: 2018-02-11
Posts: 32

Re: TSynLog for a DLL

Thank you AB.  By "append it to the .dll",  you mean putting the ".mab" file in the same folder as the DLL?  Or else?

Offline

#4 2018-02-11 17:47:01

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,700
Website

Re: TSynLog for a DLL

Append as binary, using e.g.  copy /b toto.exe + toto.mab toto.exe

Offline

#5 2018-02-11 18:24:14

xiwuping
Member
Registered: 2018-02-11
Posts: 32

Re: TSynLog for a DLL

Thank you again. How can I automatically generate the mab file (as a post build event) and merge the exe/DLL with the mab file?

Last edited by xiwuping (2018-02-11 18:24:50)

Offline

#6 2018-02-11 19:16:36

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: TSynLog for a DLL

You can Use a  map2mab utility

Offline

#7 2018-02-11 21:34:26

xiwuping
Member
Registered: 2018-02-11
Posts: 32

Re: TSynLog for a DLL

Thank you.  I appended the mab file to the DLL using copy /b.  But the generated new log doesn't seem to have the line number?   Any heads up?

Offline

Board footer

Powered by FluxBB