...">

System.AccessViolationException

I am using DLL com, as follows:

#Region "API Function"
    <DllImportAttribute("abc.dll", EntryPoint:="optcntl")> _
    Public Shared Function optcntl(ByRef pBlocks As blocks) As Integer
    End Function
#End Region

      

This DLL uses the other four dlls to complete the processing. If I change the current directory path from the / bin / folder to another folder on the C or D drive that contains the entire DLL. You receive the following error message: System.AccessViolationException: An attempt was made to read or write protected memory. This is often a sign that other memory is damaged.

Any help would be appriaciated ..

+2


source to share


1 answer


If I understand it correctly, it leads to errors when you change the current directory path to one NOT containing the four DLLs that abc.dll calls. If so, it may be that abc.dll always looks in the cursor path for the path for the other four dlls, and not in the application directory or in any specific location. However, this tends to give you a different error message, so make sure the old error related to the error is not loaded on the hard drive onto the four floppies that are accidentally caught when currendt directory changes.



+1


source







All Articles