MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

MathLink MLGetRealArray


Dear Group Members,
I am trying to get a matrix from Mathematica into a c program via 
MathLink. When I compile the code below (with Borland C++ 5.0), I 
get an Warning message Suspicious pointer conversion in line..., 
which relates to depthx. However, the variable depthx works fine.

The problem is with the array x. If I try to access the elements in x,
for example
temp = x[0][0]; temp = temp * temp;

then the program crashes.
Any suggestions. It would help me too if someone could provide  C 
program, written in connection with mathlink.

Thank you,
	Johannes Ludsteck

void kerndens(void)
{
   double **x, temp;
   long *dimsx, depthx;
   char **headsx;

   MLGetRealArray(stdlink, &x, &dimsx, &headsx, &depthx);

   MLPutReal(stdlink, x[0][0]);

   MLDisownRealArray(stdlink, x, dimsx, headsx, depthx);
}

The template file has the following form:
:Begin:
:Function:	 	kerndens
:Pattern:		kerndens[y_List,x_?MatrixQ,kernelWidth_Real]
:Arguments:		{y,x,kernelWidth}
:ArgumentTypes:		{Manual}
:ReturnType:		Manual
:End:


Johannes Ludsteck
Centre for European Economic Research (ZEW)
Department of Labour Economics,
Human Resources and Social Policy
Phone (+49)(0)621/1235-157
Fax (+49)(0)621/1235-225

P.O.Box 103443
D-68034 Mannheim
GERMANY

Email: ludsteck at zew.de


  • Prev by Date: simplifying an ugly expression
  • Next by Date: Re: Not drawing lines at polygon edges, in ParametricPlot3D
  • Previous by thread: simplifying an ugly expression
  • Next by thread: Re: MathLink MLGetRealArray