I have two functions getStatus() and checkStatus() that I have exposed using UnmanagedExports. I can successfully call them separately from C++ code. But when I call the first function getStatus() from inside the second function checkStatus() I get MissingMethodException. Following code for independent functions works fine:
[DllExport(ExportName = "GetStatusMethod", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.LPWStr)]
public static string getStatus([MarshalAs(UnmanagedType.LPWStr)]string Url)
{
string status;
//performing some action
return status;
}
[DllExport(ExportName = "CheckStatusMethod", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.LPWStr)]
public static string checkStatus([MarshalAs(UnmanagedType.LPWStr)]string someStr)
{
string status;
//performing some action
return status;
}
Following throws MissingMethodException:
[DllExport(ExportName = "GetStatusMethod", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.LPWStr)]
public static string getStatus([MarshalAs(UnmanagedType.LPWStr)]string Url)
{
string status;
//performing some action
return status;
}
[DllExport(ExportName = "CheckStatusMethod", CallingConvention = CallingConvention.StdCall)]
[return: MarshalAs(UnmanagedType.LPWStr)]
public static string checkStatus([MarshalAs(UnmanagedType.LPWStr)]string someStr)
{
return getStatus();// throws MissingMethodException
}
How to call a function (that is exposed using UnmanagedExports) from within another exposed function in c#?