Q:

Testand - Use of a C# DLL using a C# Wrapper using a C DLL

There is a C-Funktion which I use as a DLL. The function is exported by
__declspec(dllexport) uint8_t *SomeFunction(uint8_t *a);

In the respective header file.
The wrapper imports the function with
[DllImport("SomeCFunction.dll", CallingConvention = CallingConvention.Cdecl, EntryPoint = "SomeFunction")]
private static extern IntPtr SomeFunction(Byte[] array1);

The wrapper has a method with which contains the call of that function
public unsafe Byte[] SomeFunction(Byte[] array1, Byte[] array2)
{
    IntPtr parray2 = CalculateKeyFromSeed(array1);

}

Now I get the Error when executing the step in TestStand:

An exception occurred inside the call to .NET member
  '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[] array1, Byte[] array2) in
  SomeFunction.cs:Zeile 39.

Some idea how I get TestStand accepting this DLL?

A:

BadImageFormat normally means there is a mismatch in the bitness of one of the parts.
These need to match, you have 3 parts to check

Is the C dll 64-bit?
Is the C# dll 64-bit? (AnyCPU should be OK here AFAIK)
Is the TestStand process 64-bit?

