Can I override main from a library?

Just a question now, no code. But say I wanted to do something with main similar to what is done with the serialEventRun stuff where i have a function that gets called after loop if a function is pointed to. I know I can write a main in my .ino file and it will use that instead of the built in one. Can I do the same from within a .cpp file? What I'd like is that when this library is #include that this different main will be used instead of the built in one.

I wouldn’t have thought so, and I think it would be bad practice, the library shouldn’t write over the main function, it could/would lead to unexpected behaviour. Instead create a function to initialise your library (kind of like Serial.begin)