You want to call a C function from Fortran Program. There are many ways.
One way is to translate the C routine to fortran. If your C program is long, complex, and well tested then it may not be easy option for you. The other way is to convert the fortran to C. There may be similar problem to you.
If you can not skirt the problem as above, then you have to face the problem as below.
In programming parlance it is called Mixed Language Programming.
I do not know what version of which language and OS U are using. So instead of giving a ready made solution I shall give you four alternative approaches below. I have used all in implemented applications. The first two are for those lucky having a powerful OS ( a rare commodity now ). The program runs fast in both and suitable for hard real time jobs. The last two are for any OS, but program runs slow, particularly if C routine is called frequently. You also have to do little more programming work in all approaches. Be also aware that your C function returns a pointer in each of the alternatives.
Some fortran compilers ( not all ) allow calling a non-fortran function. This requires appropriate facilities in the OS where both fortran and C are running. In such cases identical stack management is used during procedure call. Read the programmers manual of both languages and code appropriately.
If this is not possible then you can trick the OS to do so but you need an intermediate function written in Assembler. You call assembler routine from fortran and then call the C routine from assembler and return in reverse manner. You need to know stack management details of all three that is of Fortran, Assembler and C and write a code for translating fortran stack to C stack. This will be in the assembler routine.
In both above approaches you have to be aware how your Linker ( or Binder ) works and you may have to do some extra job there. In either case it will be same .exe file so your program will run fast. In such OS’s any languages, strange to each other, can be mixed. Even DLL’s can be used. Only complexity comes if the run time library uses a fortran function having same name as a C function but doing different jobs. An OS supporting mixed language programming generally gives you some tools of preventing this.
If above alternatives are not feasible, then make both fortran and C programs as separate .exe and run both as two concurrent processes. ( note they can be in same computer or in different computers under different OS even ! ). Now whenever you need to call C from fortran, pass all parameters and data though any interprocess communication mechanism available to you, say pipe, socket or whatever it is. The C program can return data by similar mechanism. Be sure to add appropriate code for handling parameter passing through interprocess communication. Synchronisation of two processes and distinguishing old data from recent data is also your job. Stack management is not required.
This one is for those who dislike stack, synchronization, linker or anything that requires intelligence. Programs will run slowest if the C program has to be called frequently. Counter-intuitively, if the C program has to be called once only, then this becomes most intelligent solution too! Output data from fortran program to disk ( flat file or data-base ). Then call the C program to read from same file and return data to fortran in same manner. Be careful about closing the file before change of language. Handle all errors in file input-output calls. Else you crash.