[Top][All Lists]

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

Re: Can GnuCOBOL call functions compiled by GnuFortran?

From: Brian Tiffin
Subject: Re: Can GnuCOBOL call functions compiled by GnuFortran?
Date: Wed, 23 Nov 2022 13:07:59 -0500

Yep.  GNU Fortran at least.  Others should work as well.

As with all COBOL <-> Foreign Function Interfacing there is extra burden on the programmer to keep data types in sync, or be aware of the potentials differences.  Is an integer 32 bits or 64?  Are source code literals signed or unsigned.  Things like that, but yep, GnuCOBOL can call functions from just about everywhere.  That link to the FAQ, Chapter 5, is riddled with different approaches to FFI from GnuCOBOL.

And there my be an "official"  libffi user defined function repository soon too.  libffi exposes a cross platform layer that allows call frame setups very similar to the JVM JNI style, with little strings for datatype specs in a CALL.

And depending on how much work you want to be doing with COBOL/Fortran linkage, there is also a SWIG-Fortran wrapper on GitHub.  SWIG can make language integration a super easy thing to do.  A shared interface file and targets lots of languages, right out of the box.


On Fri, Nov 18, 2022 at 10:30 PM J Leslie Turriff <> wrote:
        It seems to me that Fortran is a very efficient language for performing math and logic
operations.  Can I call functions written in Fortran from COBOL?

Platform: Linux
Distribution: openSUSE Leap 15.4 (x86_64)
cobc (GnuCOBOL) 3.2-preview.0
Built     Nov 10 2022 17:36:35
Packaged  Oct 23 2022 01:26:05 UTC

reply via email to

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