What is the best way for falling back to dispatchMain if RunLoop is not available

I am creating a template project and I want to find a way to only use RunLoop if Foundation is already imported (for example when Process is used) and otherwise call dispatchMain() instead. What is the best way to achieve this? Is there some C magic that can resolve this at link/runtime without much overhead? (Assuming FoundationEssentials, Dispatch and Musl/Glibc already imported)