开发者

How to supress Entry Point Not Found error on loading Delphi package?

开发者 https://www.devze.com 2023-01-09 00:04 出处:网络
I maintain a program written in Delphi 6. It loads some bpl package files dynamically using SysUtils.LoadPackage. Often I change something in the program that causes a package to fail to load. When th

I maintain a program written in Delphi 6. It loads some bpl package files dynamically using SysUtils.LoadPackage. Often I change something in the program that causes a package to fail to load. When this happens a message box appears and then an exception is thrown. The message box and exception are separate.

Here's an example of the message box:

---------------------------
Connect Manager: ConnectManager.exe - Entry Point Not Found
---------------------------
The procedure entry point @Connectmanagerplugin@TConnectManagerPluginClassList@UnRegister$qqrp17System@TMetaClass could not be located in the dynamic link library ConnectManagerPack.bpl. 
---------------------------
OK   
---------------------------

And here's the exception:

---------------------------
Debugger Exception Notification
----------开发者_StackOverflow-----------------
Project ConnectManager.exe raised exception class EPackageError with message 'Can't load package Projects.bpl.
The specified procedure could not be found'. Process stopped. Use Step or Run to continue.
---------------------------
OK   Help   
---------------------------

I can't see how to stop the message box from appearing. Any ideas accepted gratefully.


Solved!

I created a copy of SysUtils.LoadPackage in my application and edited this copy to pass a second param to SafeLoadLibrary.

So the call to SafeLoadLibrary now looks like:

Result := SafeLoadLibrary(Name, SEM_FAILCRITICALERRORS);

This helped: http://msdn.microsoft.com/en-us/library/ms680621%28VS.85%29.aspx.

0

精彩评论

暂无评论...
验证码 换一张
取 消