How many Arduino sketches have you looked at that have an explicit 'main()' function? I'd say that 99.999% don't. The skeletal outline of an Arduino sketch is a 'setup()' and 'loop()' function. The required 'main()' is supplied by the build process and takes care of some housekeeping tasks, calls 'setup()', then repeatedly calls 'loop()'.
Not saying it won't work with an explicit 'main()', but there may be some task you have to take care of for yourself.
Not even saying that's your problem. But I'm not sure why you're doing something that's probably 6-sigma out there.