application-defined exception (code 0x0eedfade) after actual exception

跟風遠走 提交于 2019-12-25 07:05:20

问题


I've got a piece of legacy code written in Delphi, long before I jointed the company and the behaviour of my IDE makes me doubt a lot of my own skills.

After loading a DLL and assigning the functions OpenDB, GetError and GetErrorStr from the DLL, this code gets called:

If @OpenDB <> nil then
begin
  DB_num := OpenDB((PAnsiChar(file)));
  if DB_num = -1 then
  begin
    err := GetError;
    ErrorString := GetErrorString(err);
    raise Exception.Create(ErrorString);
    Exit;
  end
end else
  Exit;

OpenDB returns -1 and GetErrorString returns an error message and the exception is raised. No big deal, faulty databases exist and errors can always happen. What gets me is, that after the exception is raised, "...application-defined exception (code 0x0eedfade) at ..." pops up. After that I get access violations.


回答1:


The error message means that you are raising a Delphi exception across module boundaries into a piece of code that does not know how to handle Delphi exceptions. 0x0EEDFADE is the value that the Delphi raise statement passes to the dwExceptionCode parameter of the Win32 RaiseException() function. Only the Delphi and C++Builder RTLs know how to handle those kind of exceptions. You must never raise an exception across module boundaries, because one module does not know if another module can handle it. Different modules can be written in different languages/frameworks.



来源:https://stackoverflow.com/questions/32073849/application-defined-exception-code-0x0eedfade-after-actual-exception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!