<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I have two overloaded functions. One overloaded
function just rearanges one parameter from an array of extended to an array of
^extended and calls the other overloaded function. The problem is however that
the 2nd function call crashes the app. I really have no idea why therefore I'm
posting the code in the hope someone with more insight can help me
here.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>So what happens is the following; the first
debugmessages are ok and as expected. However the second debugmessages (array of
PJmFloat) crash the application. I have attached the backtrace.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Darius</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>type</FONT></DIV>
<DIV><FONT face=Arial size=2> TJmFloat = extended;</FONT></DIV>
<DIV><FONT face=Arial size=2> PJmFloat = ^TJmFloat;</FONT></DIV>
<DIV><FONT face=Arial size=2> TDynTJmFloatArray = array of
TJmFloat;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Function FitSession( Parameters : array of
PJmFloat; ChiSquareFunc : TOFitFunc ) : IFit;<BR>var i:
integer;<BR>begin<BR> //debug only<BR> for i := 0 to
High(Parameters) do<BR> ShowMessage('array of PJmFloat ' +
FloatToStr(Parameters[i]^));</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> Result := TFit.Create( Parameters,
ChiSquareFunc );<BR>end;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>function FitSession(Parameters: TDynTJmFloatArray;
ChiSquareFunc: TOFitFunc): IFit;<BR>var<BR> Params: array of
PJmFloat;<BR> i: integer;<BR>begin<BR> SetLength(Params,
Length(Parameters));</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> for i := 0 to High(Parameters) do<BR>
begin<BR> Params[i] :=
AllocMem(SizeOf(TJmFloat));<BR> Params[i] :=
@Parameters[i];<BR> end;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> //debug only<BR> for i := 0 to
High(Params) do<BR> ShowMessage('TDynTJmFloatArray ' +
FloatToStr(Params[i]^));</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> Result := FitSession(Params,
ChiSquareFunc);<BR>end;<BR></FONT></DIV>
<DIV><FONT face=Arial size=2>begin</FONT></DIV>
<DIV><FONT face=Arial size=2> SetLength(c,
2);<BR> c[0] := 2;<BR> c[1] :=
0.2;<BR> Fit := FitSession(c, @ChiSquareFunc);</FONT></DIV>
<DIV><FONT face=Arial size=2>end;</DIV></FONT></BODY></HTML>