C call, in a Fortran subroutine, within a C main program

From: Mathieu Fregeau (mathieu.fregeau_at_polymtl.ca)
Date: 10/30/03


Date: Thu, 30 Oct 2003 16:46:11 GMT

Hi guys,

I have a main program, in C (which contains the "main" ). I have some
subroutine in Fortran. There is no problems there since I know how to call
back Fortran in a C program, using the following:

in .c where I want my fortran sub to be called:
extern void __stdcall ice(long*);
...
int main(void)
{
...
int anInteger = 0;
ice(&anInteger);
... return(0);
}

in the fortran:
SUBROUTINE ice(theInt);
INTEGER theInt
...
END

ok, but the question is, how to call a C function, within a fortran
subroutine, previously called by the main "C" routine? That is of great
importance since many infos are within the C code and I want some routine in
Fortran to reach those infos at run time.

thanks a lot

Mathieu



Relevant Pages

  • Re: Printf/Write callback!
    ... write to write the output into a character (ie string) variable. ... Fortran 95. ... Note that you have to call a routine to do the output - it's not ... subroutine mylibrarysubroutine ...
    (comp.lang.fortran)
  • Re: Why read CLC?
    ... Probably have their origin in the FORTRAN world, ... Subroutine prodrec (record) ... C comment - consumes a record, ... transformers and the like, where one routine reads from a slow-device, ...
    (comp.lang.cobol)
  • Re: Fortran based MEX w/ COMMON/SAVE
    ... I believe dat (pointer to the array) and the ... SAVE at the begining of each subroutine is a bit unusual to me. ... > to unload it if there isn't a Fortran END or STOP statement. ... interaction w/ Matlab). ...
    (comp.soft-sys.matlab)
  • Re: Help Constructing Fictional Cross-Religious Movement
    ... You know how to do something in Fortran that I ... >don't know how to do despite being pretty familiar with it, COBOL ... > subroutine point ... >was finding a programming problem that seemed reasonably amenable to ...
    (rec.arts.sf.composition)
  • Re: Callbacks - Delphi and CVF
    ... | I have a FORTRAN DLL that does the computations and takes about hours ... | want to be able to access the callback functions address from every ... | subroutine in the fortran dll. ... SUBROUTINE ReportProgress ...
    (comp.lang.fortran)