You could choose a platform dependent solution and add implement it between ifdefs, for each needed platform... shouldn't be that much code to write.