Use C functions with Watcom Fortran

  • Context: Fortran 
  • Thread starter Thread starter eddyq
  • Start date Start date
  • Tags Tags
    Fortran Functions
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
eddyq
Messages
8
Reaction score
0
Is there a way to use C functions from Watcom Fortran?
 
Physics news on Phys.org
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.