[Coin-lpsolver] CLP from Compaq Visual Fortran 6.6

Matthew Saltzman mjs at CLEMSON.EDU
Wed Nov 28 13:35:09 EST 2007


On Wed, 2007-11-28 at 11:54 -0600, Michael Hennebry wrote:
> On Tue, 27 Nov 2007, Matthew Saltzman wrote:
> 
> > On Tue, 2007-11-27 at 10:48 -0600, Jose Luis Ceciliano Meza wrote:
> 
> > > Recently I have tried to create a Fortran interface to use CLP from
> > > Visual Fortran. I am trying to use some advise from Matthew Saltzman,
> > > and some experience that I have on using Lindo and CPLEX with the same
> > > purpose. However, I am having some trouble. I would like to show you
> > > what I have done and where my problem is in order to get some help
> > > from you.
> 
> When I did my thesis research, I needed to call FORTRAN
> from C++ without any special interfacing syntax.
> The important thing is that FORTRAN always gives and expects pointers.
> In the case of a scalar, it's a pointer to that scalar.
> In the case of an array, it's a pointer to the initial element.

That's F77.  For F9x, it looks from the code provided that you can
specify value or reference passing per argument.

> Unless you want to deal with name mangling,
> C++ functions called from FORTRAN and FORTRAN functions
> called from C++ should be declared extern "C".

This is a very important point, which I forgot about.  The C wrappers
for CLP do this, but it is likely that a Fortran interface will have to
wrap those, rather than calling the C++ directly (unless there is an
explicit F9x/C++ cross-linking mechanism in the Fortran compiler).

> I did have to use a compiler flag to add
> or remove underbars from function names.
> If you need to deal with underbars and don't have a compiler flag,
> you might be able to edit with the linker.
> 
> I avoided the return value issue by
> not returning a value between languages.
> 
-- 
                Matthew Saltzman

Clemson University Math Sciences
mjs AT clemson DOT edu
http://www.math.clemson.edu/~mjs




More information about the Clp mailing list