Modifications to support MSVC compiler #165
Labels
installation
Problems with the Installation of the pyunicorn package, especially windows.
maintenance
something should be improved or is outdated
Milestone
Hello, fyi the following modifications need to be made to support microsoft's compiler (srand48,drand48 and c99 dynamic arrays not supported):
core/_ext/src_numerics.c
add this below the #includes:
#ifdef _MSC_VER
#define srand48(x) srand((x))
#define drand48() (rand()/(RAND_MAX + 1.0))
#endif
funcnet/_ext/src_numerics.c
in _get_nearest_neighbors_fast,
change:
int i, j, index=0, t, m, n, d, kxz, kyz, kz, indexfound[T];
double dz=0., dxyz=0., dx=0., dy=0., eps, epsmax;
double dist[Tdim], dxyzarray[k+1];
to:
int i, j, index=0, t, m, n, d, kxz, kyz, kz;
int indexfound = (int*) malloc(sizeof(int)T);
double dz=0., dxyz=0., dx=0., dy=0., eps, epsmax;
double dist = (double*)malloc(sizeof(double)Tdim);
double* dxyzarray = (double*) malloc(sizeof(double)*(k+1));
and add to the end of the method:
free(dist);
free(dxyzarray);
free(indexfound);
The text was updated successfully, but these errors were encountered: