Exceptions, VB.NET and INTEL Fortran

E

Erik

1:
I call LAPACK Fortran routines (in a .DLL, compiled by IVF / VS2008)
from my VB.NET program. I want to have VB handle the errors generated
by LAPACK. So the LAPACK routines must throw an exception for VB to
catch.
Possible ?

2: There is this LAPACK routine named XERBLA that types out the LAPACK
error number and a string to the console. That you don't want in
Windoze. So, a possibility might be, to have XERBLA call a VB.NET sub
that handles the error number and maybe throw an exception. There is
some doc on calling VB from Fortran, but I find that very unclear (or
maybe too complex ?).
Help appreciated here.
 
O

OmegaSquared

Hello, Erik,

Sorry that I'm not familiar with LAPACK, but are the calls from VB to (or
through) a Fortran DLL for which you have access to the source code? Are you
able to modify the XERBLA routine?

If not, you might consider wrapping your LAPACK calls in a Fortran shell to
which you pass a VB callback address. The shell would have to trap the
console output and pass the required information back to the VB callback
routine which would then throw the exception.

Is that on the right track for what you need to do? Maybe (hopefully)
someone who knows LAPACK can give you simpler alternatives.

Cheers,
Randy
 
E

Erik

Hello, Erik,

Sorry that I'm not familiar with LAPACK, but are the calls from VB to (or
through) a Fortran DLL for which you have access to the source code? Are you
able to modify the XERBLA routine?

Yes, I have full access to the fortran source. I can change the XERBLA
routine. In fact, I stripped the routine of all executable statements,
so that it just does a return to caller. The I let the error number
propagate back into the VB code.
However, It would be better, for other reasons, to have XERBLA throw
an exception...
If not, you might consider wrapping your LAPACK calls in a Fortran shell to
which you pass a VB callback address. The shell would have to trap the
console output and pass the required information back to the VB callback
routine which would then throw the exception.

Is that on the right track for what you need to do? Maybe (hopefully)
someone who knows LAPACK can give you simpler alternatives.

It's not so much LAPACK knowledge that is neede here. It's the
(im)possibilities of Fortran that I'm not too familiar with...
Cheers,
Randy


thnx anyway
 
O

OmegaSquared

Hi, Erik,

So it sounds as if you could pass the address of a VB callback routine to
the Fortran DLL (either by calling a LAPACK "initialization" routine that
saves it in some static memory, or as an additional parameter in the regular
LAPACK call). Then have XERBLA call the VB callback routine (passing it the
error information) and the callback could raise the exception.

I think that is as close to your ideal as you will be able to get. One
caveat if you do choose to follow that approach. You must ensure that the
dotNet GarbageCollector doesn't move the object that contains the callback
routine between the time you pass its address and the time it invokes the
callback.

For assistance with the Fortran, you may find


http://software.intel.com/en-us/forums/intel-visual-fortran-compiler-for-windows/

to be helpful.

Cheers,
Randy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top