G
Guest
Hi,
I'm developing an ASP.NET app. In codebehind .cs file i need call an
unmanaged C++ dll.I copied the dll into the bin directory.
the header file of the dll contains the definition as
extern "C" __declspec (dllexport) void FuelEfficiency(COleDateTime
m_dtFuelEffTo,COleDateTime m_dtFuelEffFrom,CString gSimID,char *itemp);
where itemp is out parameter
Declaration of function in C# is:
[DllImport ("VMMYDLL.dll")]
public static extern void FuelEfficiency(DateTime m_dtFuelEffTo,DateTime
m_dtFuelEffFrom,string gSimID,[In,Out] char[] sb );
//calling function on a click event
private void StatSubmit_ServerClick(object sender, System.EventArgs e)
{
DateTime temp = Convert.ToDateTime(TxtFuelToDate.Value);
DateTime temp1 = Convert.ToDateTime(TxtFuelFromDate.Value);
string st = null;
FuelEfficiency(temp,temp1,"919444305923",st);//fn called
Response.Write(st);
}
I get an error :System.Runtime.InteropServices.SEHException: External
component has thrown an exception.
Is the above code correct?
Is there any way to debug unmanaged code in C#?
Thanks in advance
Priya
I'm developing an ASP.NET app. In codebehind .cs file i need call an
unmanaged C++ dll.I copied the dll into the bin directory.
the header file of the dll contains the definition as
extern "C" __declspec (dllexport) void FuelEfficiency(COleDateTime
m_dtFuelEffTo,COleDateTime m_dtFuelEffFrom,CString gSimID,char *itemp);
where itemp is out parameter
Declaration of function in C# is:
[DllImport ("VMMYDLL.dll")]
public static extern void FuelEfficiency(DateTime m_dtFuelEffTo,DateTime
m_dtFuelEffFrom,string gSimID,[In,Out] char[] sb );
//calling function on a click event
private void StatSubmit_ServerClick(object sender, System.EventArgs e)
{
DateTime temp = Convert.ToDateTime(TxtFuelToDate.Value);
DateTime temp1 = Convert.ToDateTime(TxtFuelFromDate.Value);
string st = null;
FuelEfficiency(temp,temp1,"919444305923",st);//fn called
Response.Write(st);
}
I get an error :System.Runtime.InteropServices.SEHException: External
component has thrown an exception.
Is the above code correct?
Is there any way to debug unmanaged code in C#?
Thanks in advance
Priya