help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] [Fwd: Antonio Carlos Moretti <address@hidden>]


From: Michael Hennebry
Subject: Re: [Help-glpk] [Fwd: Antonio Carlos Moretti <address@hidden>]
Date: Sun, 11 Mar 2018 12:19:34 -0500 (CDT)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)

On Sun, 11 Mar 2018, Andrew Makhorin wrote:

-------- Forwarded Message --------
From: Antonio Carlos Moretti <moretti+dated
address@hidden>
To: address@hidden
Subject:
Date: Sat, 10 Mar 2018 11:38:24 -0300

Hello,
Is there any way to call glpk from a fortran program?

Probably.
I called FORTRAN 77 from C when doing my thesis in the 1980's.
According to Wikipedia, Fortran 2003 included C interoperability.
Fortran 2018, whenever it arrives,
is supposed to be even more interoperable.

I have no subsequence experience.

Getting the external names compatible
might require compiler or linker options.
For some reason, underscores_ are often involved.
I never understood why.

C does call by value.
At the time, my FORTRAN did call by reference, i.e. pointer.
My recollection is the the standard at the time
allowed either call by reference or by value-result.
The program was ill-formed if the difference mattered.
My guess is that this was handled in Fortran 2003.
If not handled by Fortran, a C wrapper function will work.

C array indices are most significant index first.
Fortran array indices are most significant index last.

I think that Fortran now has the equivalent of C structs.
If not, passing the appropriate member of a common block
woud be equivalent to passing a pointer to a struct.

If all else fails, my guess is that C++ wrapper functions would work.

extern "C" int fredC(....);

extern "FORTRAN"
int fredF(....)
{
    return fredC(....);
}

--
Michael   address@hidden
"Sorry but your password must contain an uppercase letter, a number,
a haiku, a gang sign, a heiroglyph, and the blood of a virgin."
                                                             --  someeecards



reply via email to

[Prev in Thread] Current Thread [Next in Thread]