replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Memory Pointers from VB.NET to FORTRAN Subroutine.
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Memory Pointers from VB.NET to FORTRAN Subroutine.

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General
View previous topic :: View next topic  
Author Message
BillJohnson



Joined: 31 Aug 2011
Posts: 30
Location: Connecticut

PostPosted: Thu Sep 15, 2011 7:18 pm    Post subject: Memory Pointers from VB.NET to FORTRAN Subroutine. Reply with quote

I think I have a memory pointer issue between VB.NET calling a Compiled FORTRAN Subroutine because the call works the first time; however, subsequent calls to the same FORTRAN Subroutine produces weird values. I've tried setting some of the output variables equal to nothing in thinking that the Garbage Collector will release the memory pointers.

Below is the VB.NET parent calling function and the FORTRAN subroutine:

<<VB.NET Code>>

Dim ierr As Long
Dim x(20), y(20) As Double
Dim z(20) As Double
Dim D, D1, Dv As Double
Dim q, erg, h, s, Cp, Cv, w As Double
Dim HFLD_st As String = "C:/Program Files/REFPROP/Fluids/WATER.FLD"
Dim HFMIX_st As String = "C:/Program Files/REFPROP/Fluids/HMX.BNC"

Dim HERR_st As String = ""
For ii = 1 To 253
HERR_st += " "
Next
HERR_st = "Ok" & HERR_st

Dim press_kPa As Double
Dim temp_degK As Double
Dim Enthalpy_metric As Double
Dim entropy_metric As Double

temp_degK = Nothing
press_kPa = Nothing

AxtRefprop.HSFLSHdll(Enthalpy_metric, entropy_metric, z, temp_degK, press_kPa, D, D1, Dv, x, y, q, erg, Cv, Cp, w, ierr, HERR_ch)



<<FORTRAN Code>>

subroutine myHSFLSH (h,s,z,t,p,D,Dl,Dv,x,y,q,e,cv,cp,w,ierr,herr)

ASSEMBLY_INTERFACE(NAME="HSFLSHdll")

implicit double precision (a-h,o-z)
implicit integer (i-k,m,n)
parameter (ncmax=20) !max number of components in mixture
character*255 herr

double precision x(Smile, y(Smile, z(Smile
double precision, INTENT(OUT) :: t,p,D,Dl,Dv,x,y,q,e,cv,cp,w
integer, INTENT(OUT) :: ierr


Does anyone see anything fishy or usual here? All comments are welcomed.


Regards,
Bill
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group