true dll from VB6 problem
i am calling a true dll from vb6. the dll apparently has some problems. it starts screwing up and wont start working again till the computer is rebooted. It is always at different places and after different amounts of time. It happens on several computers.
I declare the offending function like this:
Code:
Private Declare Function n Lib "nnnn.dll" Alias "nnnn" (ByVal lng As Long) As lng_return
Public Function nnnn(ByVal lng As Long) As lng_return
nnnn = n(lp)
End Function
Is there anyway to destroy this function and redeclare it when this happens?
Re: true dll from VB6 problem
if the dll is in the process list you should be able to end the process
Re: true dll from VB6 problem
Thanks, but it isnt in the process list.
Just saw some different strange behavior ... after a while the app starts crashing on overflow errors at random places when making simple double variable assignments .... as simple as a=b (where a and b are doubles).
Re: true dll from VB6 problem
try to convert the doubles to longs as that is the datatype declared for the function
have you declared a type lng_return somewhere, the return of your function
Re: true dll from VB6 problem
Quote:
Originally Posted by westconn1
try to convert the doubles to longs as that is the datatype declared for the function
have you declared a type lng_return somewhere, the return of your function
actualy for the overflow problem all concerned variables are doubles .... strange ...
Re: true dll from VB6 problem
You're missing the point. The Function expects a Long variable type as an argument and will return a lng_return variable type. How is lng_return defined?
Re: true dll from VB6 problem
Quote:
Originally Posted by Doogle
You're missing the point. The Function expects a Long variable type as an argument and will return a lng_return variable type. How is lng_return defined?
thanks for the replies
the error is intermittent and almost never occurs at the exact same place in the code.
Public Enum lng_return
CRA= -2
CRB = 0
CRC = 1
End Enum
Re: true dll from VB6 problem
Quote:
the error is intermittent and almost never occurs at the exact same place in the code.
how can the error occur at different points, if it is calling a dll function that is causing the error?
what is the code and values passed to the function
Re: true dll from VB6 problem
Quote:
Originally Posted by westconn1
how can the error occur at different points, if it is calling a dll function that is causing the error?
what is the code and values passed to the function
good question. my guess is a memory leak inside the dll.
fixing the dll isnt a short term option unfortunately (though that will get done eventually), so I am trying to find a short term workaround.
My hope is to find a way (without modifying the dll) to "restart" the dll somehow.
I discovered that I could put the true dll inside a com dll and call it from my app ... when the problems start, I destroy the com object and then recreate it. This works but the com interface is way too slow.
some more background info:
there are two different modes to operate the application. one uses the dll a lot (thousands of calls) and the other doesnt use it at all. the app runs perfectly in the latter mode. In the former mode (calling the dll) it gets unpredictable. there is nothing random in the dll design, yet sooner or later either the dll starts returning nonsense or I start getting overflow errors at code that works perfectly in the non dll mode. I just discovered that the app occasionally stops with "out of memory" error.