Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Exporting TSiSession objects from C++ DLL without RTL and packages


#1

Hello to everyone,

I know Gurock is not supporting anymore SmartInspect, so any help you will eventually give me will be more than appreciated. Thanks in advance.

I’ve read this article Using Smartinspect logging in delphi dlls.

I understand that this scenario requires the usage of the common memory manager, which usually comes available when runtime packages and Dynamic RTL are active on all projects (dlls and application) that will use SmartInspect logging featues, in order to share the same SiAuto object (default Smartinspect instance) and keep organized all logging under the same file.

(preface: we develop our applications and dlls using C++ Builder only)
I would like to obtain the same but without RTL, packages and of course without common memory manager, so we enclosed all logging features in a single DLL (LOGDLL) which exports general purpose logging functions (no Delphi types and no SmartInspect types) that can be used by the main application and by any other dll loaded by the same process. This can also be called a wrapper.

Everything works correctly. We would like to go one step further but I’m afraid we’re doing something wrong, even if it seems to work correctly.

We still keep all SmartInspect TSiSessions creations inside the logging DLL (i.e. sessions created only by the DLL code) but we provide a function in the LOGDLL to obtain a pointer to each session object. This way any client of the LOGDLLl in our process can obtain and use a pointer to its own TSiSession from the wrapper dll and use all logging methods available. This gives the ability to use all SmartInspect logging features without wrapping them all in the LOGDLL.

This seems to work at very first sight, but I wonder if it still requires RTL and packages ON.

Here is a simple picture to help understanding the scenario:

Thank you very much for any help you can provide.
Alex B