Closed djMax closed 6 months ago
You can run lcl_embed
on the LibComponentLogging files of your library/framework, see http://0xc0.de/LibComponentLogging#embedded. lcl_embed
will add your unique namespace prefix to all symbols such that the LibComponentLogging version in your library/framework doesn't conflict with an application that uses your library/framework and LibComponentLogging.
Is there any way to do this with a preprocessor macro instead? If not I'll close the issue, but seems like it'd be nice to use one version of the code.
When using LibComponentLogging privately in a framework, then it's usually enough to just use the preprocessor macro of the back-end's config file to rename the Objective-C class of the back-end, e.g. the #define LCLLogFile <UniquePrefix>LCLLogFile
in your framework's LCLLogFileConfig.h file. If the application also brings a copy of LibComponentLogging and LCLLogFile, then you would get 2 log files: one for the application, and one for your framework.
Problems arise when you want to expose the log macros to your framework's users, e.g. then you might get 2 definitions of the lcl_log macros. Here, the renaming via lcl_embed
would help.
I'm trying to use LibComponentLogging in a library/framework that is used by an app that also wants to use LCL. I'm not sure it's currently possible to have both the library and the app define components and use LCL properly... Would be nice if it worked.