Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Use C functions with Watcom Fortran

  1. Jul 12, 2012 #1
    Is there a way to use C functions from Watcom Fortran?
     
  2. jcsd
  3. Jul 13, 2012 #2

    chiro

    User Avatar
    Science Advisor

    Take a look at this:

    ftp://openwatcom.mirrors.pair.com/archive/11.0c/docs/f77progguide.pdf

    The key things just for future notice about using external DLL's written in any language are as follows:

    1) Calling convention (for function)
    2) Structural definition and memory representation
    3) Argument structure (representation of pointers, and machine words like chars, ints, doubles, floats, longs, etc)

    The windows standard way of dealing with DLL's is with LoadLibrary for loading the DLL and GetProcAddress to get the function pointer of the DLL.

    I had a quick look at the book and it seems to cover the various calling conventions pretty well, but make sure you know how to convert between structures if say a matrix in C is not the same as a matrix in FORTRAN.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Use C functions with Watcom Fortran
  1. Fortran - Functions (Replies: 0)

  2. C to fortran (Replies: 9)

Loading...