2016-01-09 04:12 PM
Hello to all readers,
i'm really out of my mind here.I searched but nothing positive.What is my purpose here. I wanna make a .lib file (hidden code to user) but still allow to set some defines in compiler preprocessor which will be used in .lib file.For example.Lib file structure:uint8_t myArray[ARRAY_SIZE];I wanna have this #define ARRAY_SIZE to be able to set on user side, without recompile .c file again from which library was created.Is this possible to set in keil and how?2016-01-09 07:01 PM
Well you really can't pass preprocessor defines in that way. You either need to dynamically allocate structures, and pass by pointer and size, or you need to use symbols, where you define as externals in the library and populate in your application
In Libextern uint8_t *myArray;extern uint32_t myArraySize;In app#define ARRAY_SIZE 1000uint8_t myArray[ARRAY_SIZE];uint32_t myArraySize = ARRAY_SIZE;2016-01-10 12:07 AM