Thread: Linking Fortran procedures with C program

  1. #1
    gest
    Guest

    Linking Fortran procedures with C program

    Hello everybody on the boards!

    I came across the following problem. There is a program written in C (pure ANSI C). There is a library of procedures written in Fortran (in a form of .FOR file) - in fact it contains some computational routines from NAG library. It is used by C-program. The whole thing was created particular time ago and compiled using Watcom compiler under DOS. This compiler supported mixed-language progs.

    Now I need to compile the program (C+Fortran) under Win32. Actually - Windows 2000 and MS Visual C++ 6.0 is what I have. I looked up MSDN site and found that MS VC++ allows to combine code in Fortran and C++ transparently, but the compiling stage involves Microsoft Powerstation Fortran compiler - and then, as I didn't have it, I tried to find one and revealed that MS doesn't support it anymore =( I only found a trial version that expired in 1994!! changing computer date didn't help, it doesn't execute.

    Can anybody help me solve the described question? Are there any other Fortran compilers to compile the procedures into a form compatible with MSVC?

    Thanks ahead

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    This any use?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    gest
    Guest
    I see that Pro Fortran is a complete C-Fortran environment. However, I'm not eager to pay 700 bucks just for the sake of a single project. I know there are some freeware Fortran compilers - some of them compatible with MSVC, perhaps?

  4. #4
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Or just go to http://openwatcom.org and download the free Watcom C++/Fortran compiler.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  5. #5
    gest
    Guest
    Thanks for the answers!!
    I found Watcom 11.0 among my disks, but it is dated 1996 and neither its Windows- nor NT-version works on Windows XP

    Before downloading Open Watcom, there seems to be another opportunity: I've been told that MS doesn't support MS Powerstation 4.0 Fortran compiler anymore but Compaq Visual Fortran is built in latest MS VC++. Thus it provides Fortran-transparency. I tried to include my .FOR files in the project but they aren't compiled because they are considered text-files and no compilers are associated with them. The question is lame but - what should I do to associate .FOR-files with Compaq VF? what is the filename of this compiler? I'd appreciate your help on this question.

  6. #6
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Originally posted by gest
    The question is lame but - what should I do to associate .FOR-files with Compaq VF? what is the filename of this compiler? I'd appreciate your help on this question.
    Start->Settings->Control Panel->Folder Option
    File Types tab
    New
    enter extension->OK

    Change
    then find your Fortran compiler. It's probably under C:\Program Files or C:\compaq
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  2. Replies: 5
    Last Post: 09-14-2006, 09:47 PM
  3. MinGW Linking GUI Program
    By Tonto in forum Tech Board
    Replies: 19
    Last Post: 08-23-2006, 03:28 PM
  4. Linking Program
    By Da_Great_V_Man in forum C++ Programming
    Replies: 4
    Last Post: 09-15-2004, 06:15 AM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM