Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-06

DLL function exits without exception or other notice

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho

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

Reply by email

Yury Sidorov
to Felipe Monteiro de Carvalho

From: "Felipe Monteiro de Carvalho"

Show quoted text 9 lines
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:

Try to copy this function to main .exe and test it.

Yury.

Reply by email