Appologies if this is a duplicate - I've done a few searches and cannot quite find what I'm looking for... I'm hoping someone here can help me to do this in a "best practise" way using the Fortran/C interop.
Basically I have a "number cruching" dll written in using Intel Fortran which runs under a C# front end. As this could take some time I would like the dll to be able to call back the exe to inform it of its current progress.
The basic calling procedure I envisage is:
- C# passes Fortran the memory address of the C# routine to call in the exe when progress has changed (as a delegate?)
- Fortran dll updates a module procedure pointer to point to this C# routine so that it can call it later on
- C# starts the main fortran "DoWork" function
- At intermediate points in "DoWork" the C# routine is called via the pointer and C# can update the display
If anyone could point me in the right direction, or even post a small complete code - (a simple console app which passes something like an int back) I would be very greatful.