Why is this Fortran DLL not being read by my VB.NET application? -
i trying link fortran dynamic-link-library (dll) vb.net application. subroutine contained in dll supposed modify value c
provided in vb side, not doing it: keeps c
is.
here fortran code:
subroutine prueba_int(m,n,p) !dec$ attributes dllexport, decorate, alias : "prueba_int" :: prueba_int !dec$ attributes reference :: m,n implicit none integer, intent(in) :: m,n integer,intent(out) :: p p=m*n end subroutine
and here vb.net section:
public class form1 public declare sub prueba_int lib "dll2.dll path" (byref m integer, byref n integer, byref p integer) private sub btn1_click(sender object, e eventargs) handles btn1.click ofd.filter = "(*txt)|*.txt" if (ofd.showdialog() = dialogresult.ok) txtarray.text = ofd.filename end if end sub private sub btncalc_click(sender object, e eventargs) handles btncalc.click dim a, b, c integer = cint(txt1.text) b = cint(txt2.text) c = 1 call prueba_int(a, b, c) msgbox(c) 'only check c's value end sub end class
i have tried using long
instead of integer
, problem remained. can give me clue issue?
edit: both vb.net , fortran codes programmed using visual studio 2015 intel fortran compiler (parallel xe 2017). dll built using stdcall(/iface:stdcall)
calling convention.
i have found solution. thing did changing export line one:
!dec$ attributes dllexport, stdcall, reference, alias : "prueba_int" :: prueba_int
!dec$ attributes reference :: m,n
now works! thread useful, if else has same problem: https://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/topic/276310
wiki
Comments
Post a Comment