有一个 C-Funktion 我用作 DLL。该函数由
__declspec(dllexport) uint8_t *SomeFunction(uint8_t *a);
在各自的头文件中。
包装器导入函数
[DllImport("SomeCFunction.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SomeFunction")]
private static extern IntPtr SomeFunction(Byte[] array1);
包装器有一个方法,其中包含对该函数的调用
public unsafe Byte[] SomeFunction(Byte[] array1, Byte[] array2)
{
IntPtr parray2 = CalculateKeyFromSeed(array1);
}
现在在 TestStand 中执行步骤时出现错误:
在调用 .NET 成员“SomeFunction”时发生异常:System.BadImageFormatException: Es wurde versucht, eine Datei mit einem falschen Format zu laden。(Ausnahme von HRESULT: 0x8007000B) bei SomeFunctionWrapperNameSpace.WrapperClass.SomeFunction(Byte[] array1) bei WrapperNameSpace.WrapperClass.SomeFunction(Byte[] array1, Byte[] array2) in SomeFunctionWrapper.cs:Zeile 33. bei SomeFunction(Byte[] SomeFunction.cs:Zeile 39 中的数组 1,字节 [] 数组 2)。
一些想法如何让 TestStand 接受这个 DLL?