Topic: linking to C++

I want to link some Fortran routines to a Windows C++ program.  I am using MS C++ visual studio 2010.  How easy is this?  Any tips would be appreciated - articles, what fortran libraries have to be included, which kind of project to use (static library (I would prefer static linking), simple dll?).  I used to do fortran, but have not used it much for many years.  The routines are working fine in a fortran program.  The section on interoperability in the docs may have useful information but does not answer my questions.

Re: linking to C++

I would suggest using a Shared Library project (DLL) simply because the static libraries generated by Simply Fortran will not be compatible with MS Visual C++.  Simply Fortran should link in all necessary Fortran runtime code during compilation, so you shouldn't end up with issues surrounding missing DLLs on the Fortran side. 

Fortran's ISO_C_BINDING module is something you'll want to look closely at.  It should allow your Fortran functions to be created in a form that is callable by any other language as they'll conform to the C declaration standard.  I haven't personally tried linking with MSVC++ using this technique, so I'll give it a try myself, probably tomorrow, to see if it all works.

Jeff Armstrong
Approximatrix, LLC