Redefined external c functions for portability