Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application Error - DLL

Status
Not open for further replies.

psandekian

Programmer
Oct 12, 2000
48
US
Hi. I've created a DLL using LabView 6.0i and I'm using the functions in VB 6. I've set a declare sub statement so I can use the functions. When I run the code, I get an Application Error when it tries to use that function. The error says:

The instruction at "0x301fdf3b" referenced memory at "0x49ba5e35". The memory could not be "read".

I tried a simple DLL and I get the same error message but at difference address. I am trying to determine if my problem is in my VB code or my DLL. Does someone have any ideas?

Here's the code from my simple project:
Code:
Private Declare Sub DegFtoDegC Lib "e:\temp2\app\Convert_Temp.dll" Alias "F_to_C" (ByVal degF As Double, ByRef degC As Double)

Private Sub Command1_Click()

Dim DegreeF As Double
Dim DegreeC As Double

DegreeF = Text1.Text
Call DegFtoDegC(DegreeF, DegreeC)
Text2.Text = DegreeC

End Sub

Private Sub Command2_Click()
End
End Sub
Thanks.
Patty
 
I recently had the same error message and it was because the variable types that I was using my VB application did not match those in the dll.

Try this declare statement:

Private Declare Sub DegFtoDegC Lib "e:\temp2\app\Convert_Temp.dll" Alias "F_to_C" (ByVal degF As Double, ByRef degC As Any)

Simon
 
Thanks Simon! That helped. I do have a problem with my variable types. I was able to get it to work using Long in my VB and Int32 in my DLL. But I cannot get it to work with Double in VB and Float64 in my DLL. Any ideas on that one? It did not like "Any" for a variable type.

Thanks.
Patty
 
It may not be a case of if you liek it. Try it and see if it works.

I was working with a dll that FedEx wrote, and we ended up having to use this data type.

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top