address some compiler warnings
remove global mainloop from shared.h