【发布时间】:2012-06-22 08:56:58
【问题描述】:
我使用 DLL 导出查看器尝试查找此 DLL 中的函数,我找到了一个函数列表,它是:
public: int __thiscall CSTVdsDisk::GetPartitionCount(void);
问题在 C# 中我无法使用以下任何一种方法调用该函数:
[DllImport("Some.dll",
ExactSpelling = true,
EntryPoint = "GetPartitionCount",
CallingConvention = CallingConvention.StdCall,
SetLastError = true)]
或:
[DllImport("Some.dll",
ExactSpelling = true,
EntryPoint = "CSTVdsDisk::GetPartitionCount",
CallingConvention = CallingConvention.StdCall,
SetLastError = true)]
private static extern int GetPartitionSize();
他们都失败了。有什么我做错了吗?任何人都可以帮忙吗?谢谢!
【问题讨论】:
-
你可以试试这个 [DllImport("Some.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern int GetPartitionSize();
-
我现在收到一个无法找到的错误。
标签: c# visual-studio-2010 dllimport