hollen@tsunami.megatek.uucp (Dion Hollenbeck) (08/23/88)
From article <2995@dalcs.UUCP>, by silvert@dalcs.UUCP (Bill Silvert): > I need to know whether Microsoft Fortran can call routines written in > Turbo C. [...stuff deleted...] Probably can, but since I do not have Microsoft FORTRAN, I can only give you some things to watch out for. The Microsoft languages in general have a compatible calling interface (watch out for PASCAL, it is different). They push the arguements on the stack from right to left and use BP as a pointer in the callee to retrieve them. Since it is possible to call Turbo C from MSC (caveat in a minute), theoretically, FORTRAN can do this as well. (The caveat is that certain pre-defined system variables may not be resolved or conflict when linking to Turbo C and MSC libraries, but if only using one of the system libraries and your stuff, you should be ok). The real show stopper is the FORTRAN calling convention, which if you know about it can be worked around. FORTRAN passes variables by address pointer and C expects to have them passed BY VALUE. Therefore, you must write your Turbo C graphics with a 'glue' layer which will in turn call the appropriate Turbo C graphics library routines by looking at the variables passed by reference and passing their current value to the graphics routines. Be sure to look carefully in both languages for the section on 'Mixed Language Programming' to make sure all I am saying is accurate. With a little care, what you want to do should be possible and not too grisly. Dion Hollenbeck (619) 455-5590 x2814 Megatek Corporation, 9645 Scranton Road, San Diego, CA 92121 seismo!s3sun!megatek!hollen ames!scubed/