0

I would like to ask how to declare qsort function from stdlib.h in a different compilation unit and avoid warning about inconsistent dll linkage.

typedef int (*FT)(const void*, const void*); //FT has C++ linkage
extern "C"{
    typedef int (__cdecl *CFT)(const void*, const void*);//CFT has C linkage
    void __cdecl qsort(void*p, size_t n, size_t sz, CFT cmp);//cmp has C linkage
}

c:\bjarne_exercise_5.cpp(15): warning C4273: 'qsort' : inconsistent dll linkage c:\program files\microsoft visual studio 10.0\vc\include\stdlib.h(425) : see previous definition of 'qsort'

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
4pie0
  • 29,204
  • 9
  • 82
  • 118

0 Answers0