我有以下代码:
namespace WPFMuskTest
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
[DllImport
("myDll.DLL",
EntryPoint = "?Func1@FUllNameCopiedFromDependancyWalker",
CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl
)
]
public static extern System.IntPtr Func1(out System.IntPtr handle, int type, out DateTime date);
public MainWindow()
{
InitializeComponent();
//
//
//
}
private void button1_Click(object sender, RoutedEventArgs e)
{
System.IntPtr MainParam;
int thetype = 1
DateTime date;
System.IntPtr res = GetFxIRMoveForDate(out MainParam, thetype _til, out date);
}
}
}
该 exe 与被调用的 DLL 位于同一路径中,并且该函数肯定存在于 DLL 中(在 DependacyWalker 中验证),但我不断收到错误消息:
被调用的函数原型是:
类 __declspec(dllexport) OUR_DATE_TYPE { .... }
typedef 无符号长类型;typedef DATE_TYPE OUR_DATE_TYPE;
namespace1
{
namespace2
{
void func1(MyClass &myclass, const TYPE& type, const DATE_TYPE& date);
}
}
“System.AccessViolationException”类型的未处理异常
谁能告诉我为什么?