C ++ simple conditional log

Disclaimer: I am not a C ++ developer, I can only do basic things. (I understand pointers, only my knowledge is so rusty, I have not touched c / C ++ for about 20 years :))

Customization: I have an Outlook add-in written in C # /. NET 1.1. It uses C ++ shim to load.

This usually works very well, and I use C # code in my code for logging. But sometimes addin does not load, i.e. it doesn't hit the managed code at all so that I can investigate the problem from the log files.

So, I need to link some basic entries in C ++ shim - just write to a file. I need to make it as simple as possible for our users. In fact, I would prefer not to send it by default.

I was thinking of something that would check for a specific dll library (logging dll), and if so, use it. Otherwise, he will not be able to register anything. Thus, when I have a user with such problems, I can send him only the registration DLL, the user will save it in the runtime directory, and I will have a file.

I suppose this should be done with some form of factory solution that returns either a dummy logger, or if a dll is found, then the real one.

Another option would be to make some simple registrar and rebuild the gasket with or without it, based on directives. This is not a desirable approach since the lining must be signed, and I must instruct the user to make the backup “real”, then restore when it is done, etc. Instead of just saving and deleting the dll.

I would appreciate any good suggestion on how to approach it, along with links or sample code, how to go after that.

Greetings

+3
source share
2 answers

logs dll , . . dll, LoadLibrary GetProceAddress, , , ++, . n + 1 ++ , .


Google

+2

? regedit, , . , , "no logging".

+1

Source: https://habr.com/ru/post/1737534/


All Articles