469,890 Members | 2,058 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,890 developers. It's quick & easy.

Application Error - Memory could not be "read"

Any help appreciated...

I am using a third party DLL file to access an HMI using ethernet. The function is declared in a VB module as:

'Read internal word address
Public Declare Function HKEtn_ReadInternalMemory Lib "HKEserv.dll" _
(ByRef dp As Int16, _
ByVal Wordcnt As Int16, _
ByVal DeviceType As Int32, _
ByVal addr As Int32, _
ByVal lpAddr As String, _
ByVal fg As Int32) _
As Int32

When I run this function in a single-threaded application, all is good. When I run the function in a multi-threaded application, I get an error message in a message box on closing the app:

myApplication.exe - Application Error

The instruction at "0x6c3b5115" referenced memory at "0x00000004". The memory could not be "read".

Click OK to terminate the program

Could the DLL be incompatible with .NET environment? Is it that I am not cleaning up some unmanaged resources?

I'm flat out of ideas...

Thanks...
--------------------------------
From: Ryan Linneman

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>9YQNf4HMtEyh7Rjyt0ZCUQ==</Id>
Nov 21 '05 #1
2 5026
Dear Ryan,

Show me a declaration for this API in header file. I guess
first argument is something wrong.

On Mon, 06 Jun 2005 23:14:43 -0700
Ryan Linneman via .NET 247 <an*******@dotnet247.com> wrote:
Any help appreciated...

I am using a third party DLL file to access an HMI using ethernet. The function is declared in a VB module as:

'Read internal word address
Public Declare Function HKEtn_ReadInternalMemory Lib "HKEserv.dll" _
(ByRef dp As Int16, _
ByVal Wordcnt As Int16, _
ByVal DeviceType As Int32, _
ByVal addr As Int32, _
ByVal lpAddr As String, _
ByVal fg As Int32) _
As Int32

When I run this function in a single-threaded application, all is good. When I run the function in a multi-threaded application, I get an error message in a message box on closing the app:

myApplication.exe - Application Error

The instruction at "0x6c3b5115" referenced memory at "0x00000004". The memory could not be "read".

Click OK to terminate the program

Could the DLL be incompatible with .NET environment? Is it that I am not cleaning up some unmanaged resources?

I'm flat out of ideas...

Thanks...
--------------------------------
From: Ryan Linneman

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

<Id>9YQNf4HMtEyh7Rjyt0ZCUQ==</Id>

---
MVP kaok = MVP.ChangeMvpCategory("for C# 2004-2005.");
kaok.Web = "http://www.antoine.st/";

Nov 21 '05 #2
Since it's a multi-threaded app, are you making sure that none of your
threads are still running when the app closes? Could one of the
threads be trying to access an object that is no longer available?

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by ZafT | last post: by
8 posts views Thread by eastcoastguyz | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.