Re: Linking my fortran subroutines with Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg111319] Re: Linking my fortran subroutines with Mathematica
- From: Frank K <fkampas at gmail.com>
- Date: Tue, 27 Jul 2010 04:18:42 -0400 (EDT)
- References: <firstname.lastname@example.org>
On Jul 26, 6:42 am, Patrick Scheibe <psche... at trm.uni-leipzig.de> wrote: > Hi, > > just make a wrapper for your Fortran functions so you can call them from > C. Once this is done you can simply call them through the MathLink. > You could start by compiling your Fortran functions into a .so or .dll > or however the shared libraries are called on your OS. Then create a > MathLink-template and call those functions from there.. > > I really don't know how to explain this better since it is straight > forward and you should have a running example in a few minutes. > > Cheers > Patrick > > > > On Sun, 2010-07-25 at 01:58 -0400, emamm wrote: > > Hello > > > I am new to Mathematica. Although I have searched the web for answers > > on how to link fortran to Mathematica without buying MathCode F90, I > > have not found good examples on how to link Fortran to Mathematica. > > > All my fortran functions were modified to accept a C-wrapper. I did > > that to link them to another system. I have no problem to create mex files on > > either Windows or Linux using gcc,gfortran or g95 (all free > > compilers!). My fortran functions work exactly as m-file on the other system > > with lots of input and output arguments - The input arguments > > determine the size of the output arguments via malloc on C. > > > I believe that there is something similar to a mex file for > > Mathematica but the documentation on Wolfram's site does not give me > > much information. > > > Would someone out there have a nice, neat example (not too simple, > > please - addrow from Wolfram's site is way too simple!) on how to link > > fortran to Mathematica? > > > Many thanks > > > Ed > > > PS. MathCode F90 seems to do what I want but for a a price (and what a > > price!).- Hide quoted text - > > - Show quoted text - If you're using Windows, most windows Fortran compilers can generate a dll (dynamic link library) which can be called through .NETLink's DefineDllFunction. Remember that Fortran variables are passed by reference.