views:

112

answers:

1

Hi, I am using a com DLL in the following manner:

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

This DLL using the other four dlls to complete its processing. If I change the current directory path from the /bin/ folder to other folder in C or D drive which contains all the DLL. I get the following Error message: System.AccessViolationException: Atempted to read or write protected memory. This is often an indication that other memory is corrupt

Any help would be appriaciated..

+1  A: 

If I understand it correctly, this errors out whenever 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 is always looking in the currect directory path for the other four dlls rather than the application directory or some specific place. However, this would normally give you a different error message, so make sure that there is not an old bug-ridden copy of the four dlls on the hard drive that is inadvertantly being picked up when you change the currendt directory.

xpda
Thanks a lot for you reply, I put all DLLs in that particular folder which are used by abc.dll.
Yogi