Using a Fortran .lib

This is a discussion on Using a Fortran .lib within the C++ Programming forums, part of the General Programming Boards category; Hi, Someone gave me a Fortran .lib file which contain functions I need to use in a C++ program. How ...

  1. #1
    Mic
    Mic is offline
    Registered User
    Join Date
    Dec 2008
    Posts
    2

    Using a Fortran .lib

    Hi,

    Someone gave me a Fortran .lib file which contain functions I need to use in a C++ program.

    How should I do that ?

    Let's say for instance I want to call a function called "SquareRoot".

    (I'm using Eclipse (Wascana) under windows, with GNU C++ compiler)

    Cheers.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    This page has the usual method for *nix systems. That may or may not work for you, depending on how the .lib file was made.

  3. #3
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528
    What 'flavour' of Fortran is it? f77 or?

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,673
    And was the Fortran library compiled using the GNU Fortran compiler?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Mic
    Mic is offline
    Registered User
    Join Date
    Dec 2008
    Posts
    2
    Unfortunately, I can't be sure about any oh those right now.
    Isn't possible to use them without knowing how they were made ?

    I'd assume it's F77.

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,673
    > Isn't possible to use them without knowing how they were made ?
    Possibly, but it certainly raises the bar a lot.

    Calling conventions, symbol decorations etc all have to be "hacked" in some way if all the libraries are not compiled with the same tool chain.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. real-world apps in C++ (preferably simple)?
    By Aisthesis in forum C++ Programming
    Replies: 13
    Last Post: 06-12-2009, 01:03 PM
  2. How to properly use a .lib file?
    By Kurisu33 in forum C++ Programming
    Replies: 6
    Last Post: 09-28-2006, 08:19 PM
  3. Replies: 4
    Last Post: 07-06-2006, 02:53 AM
  4. what is the use of a .lib file
    By studentc in forum C Programming
    Replies: 2
    Last Post: 02-02-2006, 08:50 AM
  5. Linking Fortran procedures with C program
    By gest in forum C Programming
    Replies: 5
    Last Post: 07-14-2003, 12:35 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21