1 #ifndef PORTABLESORTING_DEFINED 2 #define PORTABLESORTING_DEFINED 1 3 4 #include "Common.h" 5 6 #ifdef __cplusplus 7 extern "C" { 8 #endif 9 10 /* 11 The reason for using this instead of C's qsort is 12 that we need more context information than just the 13 two objects if we want to do something like use an 14 Io block to do the comparison and using globals is 15 unacceptable for several reasons. 16 17 qsort_r isn't available on all platforms. 18 */ 19 20 //typedef int (ListSortRCallback)(void *, const void *, const void *); 21 22 typedef int (*PortableSortingCompareCallback)(void *context, const void *a, const void *b); 23 24 BASEKIT_API void portable_qsort_r(void *base, size_t nel, size_t width, 25 void *context, PortableSortingCompareCallback compare); 26 27 #ifdef __cplusplus 28 } 29 #endif 30 31 #endif 32