TComm problem in DLL

Q: I have the following problem: if I use the TComm component in a Delphi executable, I'm able to read the error when I try to open a serial port already opened, but if I use the component in a DLL, the resulting error is always 0 (zero).

For the test, I'm using the following code:

var
  IdErr : Cardinal;

begin IdErr := 0; try Comm1.Open; except IdErr := GetLastError; end; Result := IdErr; end;

O.S.: Windows XP SP3 Delphi version: RAD Studio 2007 / Delphi 7 Enterprise Boomerang package version: lite 5.11a


A: Unfortunately I have no idea what's problem. But you have full sources so you can check if also WinAPI function returns "no_error" code.