Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3699690
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T05:08:00+00:00 2026-05-19T05:08:00+00:00

I have an old Fortran77 program that calls a C++ function and passes several

  • 0

I have an old Fortran77 program that calls a C++ function and passes several arrays of values to it (~ 100 individual values total). I’d like to convert the arrays to derived types, to make the code more readable and give names to the individual members of the arrays.

Is it possible to pass a derived type from Fortran to a C++ function?

How does C++ know how the structure looks like? Do I have to define the structure twice (once in Fortran and once in C++), and if yes, is there any automatic way to check that both structures are in sync?

I’m using GCC; I’d obviously have to switch the Fortran code to Fortran95 or higher.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T05:08:01+00:00Added an answer on May 19, 2026 at 5:08 am

    Look into ISO_C_BINDING, the C-Fortran binding that is part of F2003. You can create a derived type with a BIND(C) attribute, which will be compatible with a C struct of the “companion C processor” (in the case of gfortran, gcc).

    See chapter 7 in the gfortran manual: http://gcc.gnu.org/onlinedocs/gfortran/Mixed-Language-Programming.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several old 3.5in floppy disks that I would like to backup. My
I have a old command line based program (its fortran if that matters) that
I have a old website that generate its own RSS everytime a new post
We have an old project written using Managed C++ syntax. I would like to
We have some old C code here that's built with nmake. Is there an
I have this old Fortran executable that can only be accessed through its GUI,
We have old Word templates that were originally written for Word 97. For each
I have an old project that uses MPXJ library to access MS Project 2010.
I have an old application developed in Delphi 2006 that I now needed to
I have an old .net 2005 web site that has some asp pages and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.