Hi, I have encountered a problem when using constants, defined in a unit used by the library, in compiled libraries (.mcl files), no source code present:
Apparently constant values, defined in a unit used by the library, are only taken during compilation time of the library, and once the library (.mcl file) is used stand alone (without source file), any changes to the constant value is ignored.
Example: library "USB_HID_Library.mcl" uses unit "USB_HID_ProjectItems" wherein the constants "VENDOR_ID" and "PRODUCT_ID" are defined. The values are used in a const table in the "USB_HID_Library.mcl" library (see my previous post).
The unit "USB_HID_ProjectItems" is different for every project, while "USB_HID_Library.mcl" is the common library to make HID products.
If the project only sees "USB_HID_Library.mcl", and not its source, then the generated USB HID product has always the Vendor_id and the Product_id that were used during initial compilation of "USB_HID_Library.mcl".
This is a problem when distributing only the .mcl files of libraries.
I assume this issue is not easy to solve. Perhaps there is a work around?
(One solution is to move the table using the constant values from "USB_HID_Library.mcl" to "USB_HID_ProjectItems", but I would like to keep it in "USB_HID_Library.mcl" for better encapsulation.)
Thanks in advance!
Using constants defined elsewhere in libraries (Ok)
Using constants defined elsewhere in libraries (Ok)
Last edited by Dany on 09 Jun 2011 18:04, edited 1 time in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Re: Problem using constants defined elsewhere in libraries
Hi,
I apologize for the late reply.
Please, can you provide me with the example which demonstrates this issue ?
Regards,
Filip.
I apologize for the late reply.
Please, can you provide me with the example which demonstrates this issue ?
Regards,
Filip.
Re: Problem using constants defined elsewhere in libraries
Hi Philip, I think you can ignore this thread, I do not think it can be solved due to the nature of libraries (of which only the .mcl file is available).filip wrote:Please, can you provide me with the example which demonstrates this issue ?
Furthermore I did use the workaround I mentioned in the first post.
So, please do not bother further about this one!
Many thanks!
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)