Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Fortran from an MFC Application

Fortran from an MFC Application

Scheduled Pinned Locked Moved The Lounge
c++helpcomquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dan Broomall
    wrote on last edited by
    #1

    I am attempting to reference some legacy Fortran code from an MFC application. I get a flood of library and include file redefinition errors when I compile the code. Is this a compatibility issue between MFC and Fortran? I can use the same code in a generic C++ application and there is no problem. Any information would be helpful. Thanks in advance! Dan Broomall GIS Programmer/Analyst Forest Technology Group 125 Crosscreek Drive Summerville, SC 29485 (843) 832-4169 - Phone (843) 873-6618 - Fax www.ftgrp.com mailto: dan.broomall@ftgrp.com The bearing of a child takes nine months, no matter how many women are assigned. - Frederick P. Brooks, Jr, The Mythical Man-Month

    M N 2 Replies Last reply
    0
    • D Dan Broomall

      I am attempting to reference some legacy Fortran code from an MFC application. I get a flood of library and include file redefinition errors when I compile the code. Is this a compatibility issue between MFC and Fortran? I can use the same code in a generic C++ application and there is no problem. Any information would be helpful. Thanks in advance! Dan Broomall GIS Programmer/Analyst Forest Technology Group 125 Crosscreek Drive Summerville, SC 29485 (843) 832-4169 - Phone (843) 873-6618 - Fax www.ftgrp.com mailto: dan.broomall@ftgrp.com The bearing of a child takes nine months, no matter how many women are assigned. - Frederick P. Brooks, Jr, The Mythical Man-Month

      M Offline
      M Offline
      Marc Clifton
      wrote on last edited by
      #2

      MFC basically creates a bunch of types, such as UINT, DWORD, WORD, BYTE, etc., that can really conflict with how someone else defined the same things. This may be part of your include file redefinition errors. I've also encountered library redefinition errors when I link one module compiled with debug mode, and another module compiled with release mode. You might need to compile all the Fortran stuff as a generic C++ DLL and import it manually into your MFC app, and get the exported function pointers yourself. You'll have to resolve any global data too. Don't use the LIB file that the compiler generates when it creates the DLL--as soon as you do, you'll be screwed again. Does this help? Marc Help! I'm an AI running around in someone's f*cked up universe simulator.

      1 Reply Last reply
      0
      • D Dan Broomall

        I am attempting to reference some legacy Fortran code from an MFC application. I get a flood of library and include file redefinition errors when I compile the code. Is this a compatibility issue between MFC and Fortran? I can use the same code in a generic C++ application and there is no problem. Any information would be helpful. Thanks in advance! Dan Broomall GIS Programmer/Analyst Forest Technology Group 125 Crosscreek Drive Summerville, SC 29485 (843) 832-4169 - Phone (843) 873-6618 - Fax www.ftgrp.com mailto: dan.broomall@ftgrp.com The bearing of a child takes nine months, no matter how many women are assigned. - Frederick P. Brooks, Jr, The Mythical Man-Month

        N Offline
        N Offline
        Navin
        wrote on last edited by
        #3

        Yuck. We had something similar in my last job. How we got stuff to work: 1. All the FORTRAN stuff was self-contained in its own static library. 2. Any functions interfacing to C++ were clearly designated in a header/source file that wrapped around the Fortran. 3. Be really careful with strings, as they are encoded differently in Fortran and C++. It was still a pain in the butt, but that's how we did it. The suggestion somebody else mentioned to use a DLL would also work pretty well, we did that in some other cases. Even a broken clock is right twice a day.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups