I'm getting System.AccessViolation Exceptions when running my code on VS2013 64 bit, framework 4+. It works when using an earlier framework or in 32 bit mode. It also works fine on both 32 bit and 64 bit on VS2010 with framework 4.
The culprit is in here somewhere:
GCHandle handle = GCHandle.Alloc(buffer, GCHandleType.Pinned);
IntPtr ptr;
if(CPU.Is32Bit)
{
ptr = (IntPtr)(handle.AddrOfPinnedObject().ToInt32() + index);
}
else
{
ptr = (IntPtr)(handle.AddrOfPinnedObject().ToInt64() + Convert.ToInt64(index));
}
res = beEncodeChunk(hbeStream, nBytes / 2, ptr, pOutput, ref pdwOutput); //<--- Error here
in debugging it, ptr in vs2010 in 64 bit mode is a number like
35545824
whereas in vs2013 in 64 bit mode i'm getting
888151484352
it looks like the compiler in vs2013 is maybe using a different memory address space to vs2010. Am I doing something obviously stupid here or barking up completely the wrong tree?
It seems the version of lame i'm using is not truly 64 bit compatible and doesn't like having a 64 bit IntPtr passed into it. I've resolved my issue by using a newer version of the DLL along with this library:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.