Wierd VB, divide by zero error with CVF DLL

Wierd VB, divide by zero error with CVF DLL

Hi. I'm writing a VB driver for a CVF dll. When control returns to VB after executing the dll, I get a Divide By Zero Error (code 11) at the statement immediately following. Here are the particulars:

0) This is not the first version of the interface and worked perfectly prior to some additions to the argument lists including changes in the Fortran and in the VB.

1) The Fortran dll works flawlessly when compiled and linked into an executable using a hard wired, Fortran driver with all array bounds checking, argument type checking, variable declaration, etc., switches on the compiler turned on.

2) I have *thoroughly* wrung out the interfaces over the last two weeks and ensured that all data types match up and all array declarations are identical on each side of the interface both where defined and where they are called.

3) Using the VB debugger, I have examined the values of arguments before, and after passage to the dll and they are correct and consistent.

4) Using write statements, I have positively confirmed that all arguments passed to the dll have the proper value within the dll.

5) The call to the dll is in an integer, For-Next loop. The statement immediately following the call is

x = 10

If x is declared as a single or double precision variable, I get a Divide By Zero Error and the debugger highlights this line. If x is declared as an integer, I get no error and the program executes normally. Stranger still, if x is a real, and I get the Divide By Zero Error, I can manually step the program forward and it will advance to the next iteration in the loop, execute the dll, and again stop at the line, x = 10 with the Divide By Zero Error. All values are updated properly including x. Theoretically, I could step the program forward at each point and ultimately, after 9782 steps, complete execution!

6) Behavior is identical whether the program is run from within the VB IDE, or compiled to an executable and run using a double-clicked icon.

7) I have a CaseSelect structure inside the loop, immediately following the dll call. If the x = 10 line is placed after the CaseSelect, the CaseSelect executes normally but I still get the error on the x = 10 line.

Can anybody help me here? I've been two weeks on this and am out of ideas.

Huntsville, AL

1 envío / 0 nuevos
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.