[Lazarus] Buffer dealocating between program and C++ library
Leonardo M. Ramé
l.rame at griensu.com
Thu May 12 13:41:58 CEST 2011
On 2011-05-12 11:04:30 +0200, Mattias Gaertner wrote:
> On Wed, 11 May 2011 19:49:15 -0300
> Leonardo M. Ramé <l.rame at griensu.com> wrote:
>
> >[...]
> > > > if @lGetDicomImage <> nil then
> > >
> > > if lGetDicomImage <> nil then
> > >
> > > What mode are you using? Delphi?
> >
> > No, I'm using objfpc.
>
> Then the "if @lGetDicomImage <> nil then" is a tautology.
Then, how should I check if the function is part of the library?.
>
>
> > > > if @lDeleteBuffer <> nil then
> > > > lDeleteBuffer(lBuffer); // <----- memory keeps increasing here.
> > > > end;
> > >
> > > end;
> > > if lBuffer<>nil then
> > > lDeleteBuffer(lBuffer);
> >
> > I don't understand this. Do you mean, I should call lDeleteBuffer aftert
> > the "end;" that closes the loop?.
>
> Yes. The C code was not enough to be sure about the state of lBuffer.
>
> BTW, I'm not sure about the "out" in cdecl. Better use the real
> equivalent "var".
>
Thanks.
--
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the Lazarus
mailing list