我的WinForms项目存在问题,该项目是在VS2005 .NET Framework 2.0中创建的,我刚刚升级到VS2012 .NET Framework 4.5.在我的项目中,我使用了第三方DLL DllImport并使用了它的功能,因为我有他们的所有文档.
问题是导入的DLL中的一个函数在VS2005中工作正常.NET Framework 2.0在VS2012 .NET 4.5中不起作用.
以下是我项目的代码片段:
[DllImport("W5EditLD.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "K5GetClassName")]
public static extern string GetClassName();//Dll import definition
public string _GetClassName()
{
return GetClassName();//wrapper function to DLL import function
}
string sClassName = _GetClassName();//where i call API via wrapper method,**
Run Code Online (Sandbox Code Playgroud)
上面的代码片段在VS2005 .NET Framework 2.0中运行正常但是当我将项目升级到VS2012 .NET Framework 4.5时,我必须按以下方式执行此操作:
[DllImport("W5EditLD.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "K5GetClassName")]
public static extern IntPtr GetClassName();//Dll import definition
public IntPtr _GetClassName()
{
return GetClassName();//wrapper function to …Run Code Online (Sandbox Code Playgroud)