[fpc-devel] DLL function exits without exception or other notice

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Sat Jun 30 17:27:50 CEST 2007


Hello,

I have a code on a Dll which when executed causes the funtion to
simply exit without raising an exception or anything. It just exits
without notice, and also quits from the function that called it, like
if it was an Exception, except that a try...except...end block doesn't
catch anything. Here is the code layout bellow. The first message box
is shown, but the second is never shown:

  FImageData: PLongWord;
  color: COLORREF;
  .....
  Windows.MessageBox(0, PChar('FImageData: ' +
IntToHex(Cardinal(FImageData), 8)), lpDynamicModeError, MB_OK);

  color := FImageData[x + dy * mGlassWidth];

  Windows.MessageBox(0, 'Entering DrawGlass 2', lpDynamicModeError, MB_OK);

---

I am using a very recent 2.1.5 FPC from the Lazarus snapshots. The
value of FImageData looks ok on the first message box. This pointer is
allocated by Windows using the CreateDIBSection function.

It's quite strange that the exact same code fails the first time it is
executed, and behaves normally, as I would expect, on the second time
it is executed.

Any ideas? I am using the standard compile option of lazarus for a dll
project, except that I don't include any debug info.

thanks,
-- 
Felipe Monteiro de Carvalho



More information about the fpc-devel mailing list