Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29276 Discussions

Exposing a variable to vb whilst fortran code is running

Jonathan_Mills
Beginner
733 Views

Hi, I've got a com server (fortran DLL)that I've created in Fortran that runs a mathematical model that takes about a minute to run when it's called from vb (using a method I created in the com server wizard). It all works fine, but I want to be able to query a fortran variable (that is updated frequently whilst the model is running) from the vb user interface so that I can cause a vb progressbar to update. Obviously I can't just call another method from vb to query the variable as it won't process this code until the model has finished running. Can you tell me if this is possible and if so how?!

Any help would be much appreciated,

Jonathan.

0 Kudos
4 Replies
g_f_thomas
Beginner
733 Views

Hi, I've got a com server (fortran DLL)that I've created in Fortran that runs a mathematical model that takes about a minute to run when it's called from vb (using a method I created in the com server wizard). It all works fine, but I want to be able to query a fortran variable (that is updated frequently whilst the model is running) from the vb user interface so that I can cause a vb progressbar to update. Obviously I can't just call another method from vb to query the variable as it won't process this code until the model has finished running. Can you tell me if this is possible and if so how?!

Any help would be much appreciated,

Jonathan.

Yes it is possible and has been discussed here many times in the past so do a search of the forum's archive to dig up the howto info.

If the dll runs in a minute as a COM entity it will likely run a lot faster as a straight dll andthe VB progress bar will display for a flash. Is it worth the trouble to implementa progress bar for such a short duration calculation?BTW, which VB do you mean, classic or .NET?

Gerry

0 Kudos
Jonathan_Mills
Beginner
733 Views
Quoting - g.f.thomas

Yes it is possible and has been discussed here many times in the past so do a search of the forum's archive to dig up the howto info.

If the dll runs in a minute as a COM entity it will likely run a lot faster as a straight dll andthe VB progress bar will display for a flash. Is it worth the trouble to implementa progress bar for such a short duration calculation?BTW, which VB do you mean, classic or .NET?

Gerry

Thanks Gerry, I'll do a search (I just wasn't sure what terminology to search for!). The vb is .net. As for the runing time - the model can be set to run many times over in sequence - so could be for several minutes in total, depending on PC system.So I need a way to show the user that the system is still working etc and to provide feedback on how much longer the model has to run. I want to avoid the user thinking that the system has hung if nothing appears to be happening and the software is unresponsive.

Jonathan

0 Kudos
g_f_thomas
Beginner
733 Views

Thanks Gerry, I'll do a search (I just wasn't sure what terminology to search for!). The vb is .net. As for the runing time - the model can be set to run many times over in sequence - so could be for several minutes in total, depending on PC system.So I need a way to show the user that the system is still working etc and to provide feedback on how much longer the model has to run. I want to avoid the user thinking that the system has hung if nothing appears to be happening and the software is unresponsive.

Jonathan

I agree, it's good to know how to do this for long calculations.

I don't do VB .NET, just C#. I'm told that the keyword in VB is Delegates. If you look at

http://www.codeproject.com/KB/dotnet/DllExport.aspx

you'll see that a valid strategy is to do DLL EXPORTs from .NET just as you can from IVF, and avoid using COM (which IMO is a pain and a real time waster). The CodeProject is a great resource: it's participants pull no punches when they are presented with a dud of a thing such as one comes upon all too often via google.

Good luck,

Gerry

ps

I'd attach a C# demo that I posted here previouslyto give you an idea of what can be done but the Add Files feature of this editor doesn't appear to be working.

0 Kudos
g_f_thomas
Beginner
733 Views
Quoting - g.f.thomas

I agree, it's good to know how to do this for long calculations.

I don't do VB .NET, just C#. I'm told that the keyword in VB is Delegates. If you look at

http://www.codeproject.com/KB/dotnet/DllExport.aspx

you'll see that a valid strategy is to do DLL EXPORTs from .NET just as you can from IVF, and avoid using COM (which IMO is a pain and a real time waster). The CodeProject is a great resource: it's participants pull no punches when they are presented with a dud of a thing such as one comes upon all too often via google.

Good luck,

Gerry

ps

I'd attach a C# demo that I posted here previouslyto give you an idea of what can be done but the Add Files feature of this editor doesn't appear to be working.


It appears that uploading works OK.

Gerry

0 Kudos
Reply