I am attempting to compile and link a Fortran code calling c subroutine:
Fortran code:
program adder
integer a,b
a=1
b=2
call addnums(a,b)
stop
e
Here's two things I can see right off the bat (I work mainly with FORTRAN77 so this may not be the newest or best way to do this):
Since your C function is, well, a function (and not a subroutine), you'll need to declare 'addnums' as EXTERNAL. Add this to your code in your declarations section.
EXTERNAL addnums
Add an underscore to the name of the function in your C code. FORTRAN does this automatically to its own functions, but not to functions in other languages. So, the function's signature would be
void addnums_( int* a, int* b )
This page has a pretty good rundown on mixing C and FORTRAN. Hope this helped!