We have a C++ library where some methods are defined and exported and are being used by our .NET (V 3.5) application. In the c++ library, a function is defined as below
int DLLEXPORT RunAnalysis(long *time, long handle, int *Status)
{
// some code...
}
in .Net assembly
Declaration
[DllImport("wt3145.dll")]
private static extern int RunAnalysis(ref long Time, long Handle, ref int status);
Usage
// Some work..
ErrorCode = RunAnalysis(Time, ref Handle, ref Status);
// Some other work
every time this call is encountered an AccesViolationException occures. it gets solved only when i pass the second parameter with ref keyword although it is not being passed using a pointer.
Any specific reason for this behavior???
try
longin C++ is not the same aslongin C#.