Prev: Fast Matrix Exponential
Next: Sorting Question
From: Bjørnar on 3 May 2010 07:29 I want to create a DLL from my MATLAB code for use in a FORTRAN project. Is it possible? From the documentation it seems that only C/C++ is supported? with regards Bjørnar Lund, Trondheim, Norway
From: Rune Allnor on 3 May 2010 09:00 On 3 Mai, 13:29, "Bjørnar " <bjornar.l...(a)sintef.no> wrote: > I want to create a DLL from my MATLAB code for use in a FORTRAN project. Is it possible? From the documentation it seems that only C/C++ is supported? You need to know what you're doing to pull that sort of thing off. The problem is name mangling in object code. A function name 'f' in the sorce code is converted to something like '_f', 'f_' or '_f_' in the compiled object code. Since a DLL is a set of object code functions, you need to know exactly what happened to be able to call the correct name from your FORTRAN program. One of the problems with FORTRAN is that these kinds of things exist in any number of combinations, that depend on anything from OS to compiler to what other language you attempt to interface with. So you will have to do a lot of digging to find the relevant details. Apart from that, matlab is based on LAPACK, which used to be written with FORTRAN in mind. You might be better off calling the LAPACK library directly from your FORTRAN routines. Rune
From: James Tursa on 3 May 2010 09:47 "Bjørnar " <bjornar.lund(a)sintef.no> wrote in message <hrmc21$mt4$1(a)fred.mathworks.com>... > I want to create a DLL from my MATLAB code for use in a FORTRAN project. Is it possible? From the documentation it seems that only C/C++ is supported? > > with regards > Bjørnar Lund, Trondheim, Norway What is this dll going to do? What version of Fortran are you going to use? James Tursa
From: Bjørnar on 4 May 2010 08:29 "James Tursa" <aclassyguy_with_a_k_not_a_c(a)hotmail.com> wrote in message <hrmk4t$anu$1(a)fred.mathworks.com>... > "Bjørnar " <bjornar.lund(a)sintef.no> wrote in message <hrmc21$mt4$1(a)fred.mathworks.com>... > > I want to create a DLL from my MATLAB code for use in a FORTRAN project. Is it possible? From the documentation it seems that only C/C++ is supported? > > > > with regards > > Bjørnar Lund, Trondheim, Norway > > What is this dll going to do? What version of Fortran are you going to use? > > James Tursa This DLL is a purely numerical solver (ODE problem using the bvp4c function). I am currently using the Intel FORTRAN 10.0.025 compiler embedded in MSVS 2005. - Bjørnar
From: Bjørnar on 4 May 2010 08:32
Rune Allnor <allnor(a)tele.ntnu.no> wrote in message <6a4050bf-1bed-4667-a85e-cf23436888ff(a)q32g2000yqb.googlegroups.com>... > On 3 Mai, 13:29, "Bjørnar " <bjornar.l...(a)sintef.no> wrote: > > I want to create a DLL from my MATLAB code for use in a FORTRAN project. Is it possible? From the documentation it seems that only C/C++ is supported? > > You need to know what you're doing to pull that sort of thing off. > > The problem is name mangling in object code. A function name 'f' in > the sorce code is converted to something like '_f', 'f_' or '_f_' > in the compiled object code. Since a DLL is a set of object code > functions, you need to know exactly what happened to be able to > call the correct name from your FORTRAN program. > > One of the problems with FORTRAN is that these kinds of things > exist in any number of combinations, that depend on anything from > OS to compiler to what other language you attempt to interface with. > So you will have to do a lot of digging to find the relevant details. > > Apart from that, matlab is based on LAPACK, which used to be written > with FORTRAN in mind. You might be better off calling the LAPACK > library directly from your FORTRAN routines. > > Rune Thanks for your comments. I understand that this is not trivial. Also, since I depend on the bvp4c function it seems to me that using LAPACK is not an option. Bjørnar |