I seem to be missing something very obvious concerning libary naming and initialization: When I write a library, I need to provide a bool mgos_<libname>_init(void)
function to initialize the library.
The documentation concerning libraries states that the bit is deduced from the name of the directory the library is located in by default. If this is not what I want, I should override the value using the “name” parameter in the mos.yml manifest.
I was pulling out my hair trying to get this to work and grepping through the mos tool sources with little success until I realized that the ‘name’ parameter needs to be set in the dependancy section of the mos.yml of the application including the library, not in the library’s mos.yml.
This doesn’t really make sense because the mgos_init function is hardcoded in the library. Why would I want to override it in my application. Surely the intention can’t be to provide a mechanism to implement an alternative initialization function? At the very least the mos tool should honor the ‘name’ the library provided for itself, but that value is not used.
Also shouldn’t the default name be the name of the repo, not the library? This would allow me to clone libraries into directories named however I want them, but still have a standardized name for init?
Am I missing something here? I have a feeling I’m missing something…