Home » U++ Library support » U++ Core » How to know if a package is loaded
Re: How to know if a package is loaded [message #29501 is a reply to message #29497] |
Mon, 25 October 2010 08:27 |
|
koldo wrote on Sun, 24 October 2010 22:17 | Hello all
A simple question: How a cpp source can know if a package is loaded?
Imagine a general purpose library that includes some feature for GridCtrl package. If the programmer uses this package but s/he does not include GridCtrl, there will be a linking error.
Of course it is possible to use flags in the main package configuration but, is there another cleaner way?
|
Hi Koldo,
I'm afraid there is no direct and reliable way.
The closest you can do is probably convert the feature into template. If the user doesn't use the necessary package he shouldn't instantiate the template and everything should link just fine.
BTW: Adding this to theide would be great, I hit this issue few times too. And it should be quite simple to code, just extend the Accept field in .upp files/package manager. Let's say adding GridCtrl to Accept would cause flagGridCtrl macro to be defined if the package is used in the current project. The only problem I see is that packages using this could cause trouble with older versions of theide. But probably nothing too serious, it would just omit the extending features. Do you think I should try to implement it?
Best regards,
Honza
|
|
|
Goto Forum:
Current Time: Thu May 23 14:41:19 CEST 2024
Total time taken to generate the page: 0.02293 seconds
|