dear Salem
many thanks for your help -
I have also just tried to include __cdecl in my function prototype as
Code:
int __cdecl comprows2(void *x1,void *x2)
but that gives the same error
the compare function code is
Code:
int comprows2(void *x1,void *x2)
{
int *r1,*r2;
int i,ret;
r1=*(int **)x1;
r2=*(int **)x2;
if (r1[dis[0]]<r2[dis[0]]) return -1;
else if (r1[dis[0]]>r2[dis[0]]) return 1;
else
{
if (r1[dis[1]]<r2[dis[1]]) return -1;
else if (r1[dis[1]]>r2[dis[1]]) return 1;
else
{
ret=0;
for(i=0;i<nmark;i++)
{
if (r1[marker[i]]<r2[marker[i]])
{
ret= -1;
break;
}
else if (r1[marker[i]]>r2[marker[i]])
{
ret= 1;
break;
}
}
return ret;
}
}
}
and I call it with qsort as
Code:
qsort(haplo0,nchrom,sizeof(int *),comprows2);
haplo0 is a 2D int array and dis is a 1D array containing the columns I want to sort by
many thanks again