Re: Can GnuCOBOL call functions compiled by GnuFortran?

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

 



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

https://gnucobol.sourceforge.io/faq/index.html#does-gnucobol-interface-with-fortran

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.

Cheers,
Blue

On Fri, Nov 18, 2022 at 10:30 PM J Leslie Turriff <jlturriff@xxxxxxxx> wrote:
Hello,
        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?

Leslie
--
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


[Index of Archives]     [Gcc Help]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Info]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux