Native loading works good. Loading from .net gives error Unable to load DLL 'my.dll': Invalid access to memory location

微笑、不失礼 提交于 2019-12-02 13:01:19

问题


I'm trying to use native dll, using DllImport. And I receive such error.

System.DllNotFoundException: Unable to load DLL 'my.dll': Invalid access to memory location. (Exception from HRESULT: 0x800703E6)

That dll loads normally when is called from native code (it is used from delphi app). But when I call it from .net code, it gives me exception above.

I've read this link Windows Vista: Unable to load DLL 'x.dll': Invalid access to memory location. (DllNotFoundException), but no solution helps.

DEP, Administration rights are not the case.

P.S. This situation occurs on Windows 2008 server. On Win 2003 Server and XP everything works great.


回答1:


It seems I've found the problem. The problem was in DEP feature. When I switched on DEP for essential programs only, it gave no effect. But when I completely switched off DEP, and rebooted my server, error has gone. The one more thing I've done - installed latest updates for .net 4.0



来源:https://stackoverflow.com/questions/5375675/native-loading-works-good-loading-from-net-gives-error-unable-to-load-dll-my

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