Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
390 views
in Technique[技术] by (71.8m points)

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

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...