By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,928 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,928 IT Pros & Developers. It's quick & easy.

Application Error - Memory could not be "read"

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.