Properly define weak functions taking care of the compiler and portability