I am trying to replicate functionality of a C++ library in C# and one of its features is that it can expose some of its functions to the outside.
Now when i call SetAllAnalog() I get the below mentioned exception. This is not really a Question how to fix it, because I could just wrap the internal functions in another function which I then export.
Although I would like to know why this is happening and if there might be a better way to fix this other than the already mentioned fix.
I have following code:
[DllExport("OutputAllAnalog", CallingConvention = CallingConvention.StdCall)]
public static void OutputAllAnalog(int Data1, int Data2)
{
if (!_k8055D.Connected || Data1 < 0 || 255 < Data1 ||
Data2 < 0 || 255 < Data2) return;
_k8055D.AnalogOutputChannel[0] = (double)Data1 / 255 * 5;
_k8055D.AnalogOutputChannel[1] = (double)Data2 / 255 * 5;
}
[DllExport("SetAllAnalog", CallingConvention = CallingConvention.StdCall)]
public static void SetAllAnalog()
{
OutputAllAnalog(255, 255); //exception
test(); //No exception
}
public static void test()
{
}
Exception:
An unhandled exception of type 'System.MissingMethodException' occurred in K8055Test.exe
Additional information: Method not found: 'Void K8055Simulation.K8055.OutputAllAnalog(Int32, Int32)'.