将VC ++与C#比较加载DLL [英] Compare VC++ to C# w.r.t loading a DLL
问题描述
亲爱的所有人,
昨天,我尝试使用PIO调用..像DLLIMPORT命令将设备的第三方dll加载到C#.每当我运行该应用程序时,由于加载dll失败而导致构建失败.我以为,给定的dll已损坏.
接下来,我想使用__stdCall命令从VC ++加载.我收到一条消息,因为zlib1.dll无法引用..
我在C#/VS 2008 IDE中没有收到类似的错误消息吗?请向我建议我的IDE的相关设置.
谢谢与问候,
Kota V Subrahmanyam,
CMC Ltd,海得拉巴.
Dear All,
Yesterday, I tried to load the third party dll of my device to C# using PIO calls .. like DLLIMPORT command. Whenever I run the application, build failed because of Loading the dll failed. I thought that, that given dll was corrupted.
In the next, I thought that wants to load from VC++ using __stdCall command. There I got a message as zlib1.dll is not able to refer ..
I am not getting a similar kind of error message in C# / VS 2008 IDE ? Please suggest me the related settings to my IDE.
Thanks & Regards,
Kota V Subrahmanyam,
CMC Ltd, Hyderabad.
推荐答案
您需要检查dll的文档,以确保您的DLLImport
属性正确.这与VS 2008 IDE无关,因为仅在实际运行程序时才引用dll.确保DLL也可以在与exe文件相同的目录中访问,也可以在通过PATH
环境变量访问的目录之一中访问.
You need to check the documentation for the dll to make sure yourDLLImport
attributes are correct. This has nothing to do with VS 2008 IDE as the dll is only referenced when you actually run your program. Make sure the DLL is also accessible either in the same directory as the exe file or in one of the directories accessible via thePATH
environment variable.
这篇关于将VC ++与C#比较加载DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!