I have a fortran (unmanaged code) dll as the calculation engine, and a C# form as the GUI.
Now, the calculation in fortran is long, so in order not to bore the users, I decided to use Asynch command to create a progress bar. The fortran dll would be responsible for putting messages in the progress bar as the calculation proceeds.
Any idea how this can be done?
You have to implement anoter function in Fortran dll that reports progress in numbers. For instance: “GetCalculationProgress” that returns two integers (current iteration and total number of iterations). You call that function periodically in another thread in your C# app and read those values. In Fortran you might have to use global variables to track those.
Besides, Here is a link that explains callback method:
http://xtechnotes.blogspot.com/2008/07/callback-to-c-from-unmanaged-fortran.html