Aliyoos1 Posted May 12, 2011 Posted May 12, 2011 Calling Fortran DLL from VB.Net Program Hi Everyone, I need help with the following, I appreciate if someone can help. I have problem with calling a Fortran DLL from VB.net Program. The VB program provide the GUI while the Fortran DLL does the calculations. The Fortran DLL opens and reads from data files supplied by the VB program. however, DLL program displays a message that says it can not open the file. this is VB declaration of the DLL: DeclareSub WIDTH_SUB Lib"C:\ALI\Namoi_TM\Data\Test\WIDTH_SUB.DLL" (ByVal Rating AsString, ByVal Rating_Len AsInteger, _ ByVal Height AsString, ByVal Height_Len AsInteger, _ ByVal Output AsString, ByVal Output_Len AsInteger) and here the call statement in the VB program Call WIDTH_SUB(Rating, Len(Rating), height, Len(height), output, Len(output)) This is where fortran DLL can't pass SUBROUTINE WIDTH_SUB(RFILE,GFILE,OUTPUT) IMPLICIT NONE DLL_EXPORT WIDTH_SUB CHARACTER(len=*),INTENT(IN)::gfile,rfile,OUTPUT OPEN(UNIT=100,FILE=rfile,STATUS='old',iostat=ierr) if(ierr.ne.0)then write(*,20) trim(rfile) 20 format('Cannot open file ',a,' for input.') WRITE(*,*)'ierr= ',ierr go to 9990 end if the ierr value is 155 and VB error message is "AcccessViolationException was unhandled: Attempted to read or write protected memory." Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.