Please explain me, why LabVIEW Memory  Manager don't like this code. 
LabVIEW crashes when I call dll to find roots of polynomial. 
(For my University I should make this programm without using LabVIEW function - Polinomial Roots) 
:headbang: 
#include "extcode.h" 
#include <math.h> 
#define maxiter 500 
#define DBL_EPSILON 1e-9 
int roots(double *a,int n,double *wr,double *wi) {...} 
void deflate(double *a,int n,double *b,double *quad,double *err) {...} 
void find_quad(double *a,int n,double *b,double *quad,double *err, int *iter) {...} 
void diff_poly(double *a,int n,double *b) {...} 
void recurse(double *a,int n,double *b,int m,double *quad, double *err,int *iter) {...} 
void get_quads(double *a,int n,double *quad,double *x, short *error) {...} 
typedef struct { 
	long dimSize; 
	double elt[1]; 
	} TD1; 
typedef TD1 **TD1Hdl; 
extern "C"{ 
__declspec (dllexport) long Polynom(TD1Hdl coef, TD1Hdl mr, TD1Hdl mi, short *error); 
} 
__declspec (dllexport) long Polynom(TD1Hdl coef, TD1Hdl mr, TD1Hdl mi, short *error) 
	{ 
		double  a[21], x[21], quad[2], wr[21], wi[21]; 
		int n, numr, i; 
		n=(*coef)->dimSize-1; 
		for(i=0; i<=n; i++){ 
			a=(*coef)->elt; 
		} 
		if ((n < 1) || (n > 20)) { 
			*error=1; 
			goto out; 
		} 
		*error=0; 
	// get coefficients of polynomial 
		if (a[0] == 0) { 
			*error=1; 
			goto out; 
		} 
		*error=0; 
		if (a[n] == 0) { 
			*error=1; 
			goto out; 
		} 
		*error=0; 
	// initialize estimate for 1st root pair  
		quad[0] = 2.71828e-1; 
		quad[1] = 3.14159e-1; 
	// get roots  
		get_quads( a, n, quad, x, error); 
		roots( x, n, wr, wi); 
		numr = roots( x, n, wr, wi); 
		(*mr)->dimSize=numr; 
		(*mi)->dimSize=numr; 
		for (i=0; i<=numr; i++){ 
			(*mr)->elt=wr; 
			(*mi)->elt=wi; 
		} 
out: 
	return 0; 
	} 
Full code and VI:Download File:post-4254-1148137671.zip