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

Internal write chrashes the DLL

oliverk
Beginner
2,722 Views
I am programming with VB.NET (VS .NET 2003). My VB-application makes calls to many external FORTRAN-routines. I collected these FORTRAN-routines in two DLL's, the simulation- and graphic-module.
The graphic module does some drawings using the DC of a picturebox control. I use an internal write to put some numbers on the axis and the graphs. It looks like:
WRITE(strText,'(F7.2)') xmax
Everything worked fine using CVF 6 + VB 6 and also using VB 6.0 and IF7/8. Now I am using IF 9 and VB.NET. My VB.NET application crashes right during the internal write with
System.NullReferenceException: Object reference not set to an instance of an object
Does anybody have a hint for me.
Many thanx in advance
Oliver

Message Edited by OliverK on 03-02-2006 05:55 AM

0 Kudos
32 Replies
oliverk
Beginner
1,016 Views

The total simulation time of my case is 756, the time step is between 1E-4 and 0.5, the routine gets 3 times per time step called. After 10 min clicking I am getting tired and ESP is not changing.... :-(

Is there any other chance for tracking the ESP? For instance writing it to a log-file?

0 Kudos
Steven_L_Intel1
Employee
1,016 Views
If ESP is not changing after several calls, then that probably isn't the issue. Though you can set a "stop after" count for the breakpoint of you want. Are you sure that the string you're writing into has the correct length?
0 Kudos
oliverk
Beginner
1,016 Views

1.) I set the breakpoint at the first statement in the routine (line 23)

2.) the ESP was there constant at 0012B08C

3.) if the System.NullReference Exception occured at line (42) the ESP was at 0012AF7C (I guess it nothing unusual, if the stackpointer chnges inside a routine?

----

To your question: Since this error occurred I disabled all internal write statements and have only one left at line 42:

WRITE(strText, *) 234.45

whre

0 Kudos
oliverk
Beginner
1,016 Views

1.) I set the breakpoint at the first statement in the routine (line 23)

2.) the ESP was there constant at 0012B08C

3.) if the System.NullReference Exception occured at line (42) the ESP was at 0012AF7C (I guess it nothing unusual, if the stackpointer chnges inside a routine?

----

To your question: Since this error occurred I disabled all internal write statements and have only one left at line 42:

WRITE(strText, *) 234.45

where

0 Kudos
oliverk
Beginner
1,016 Views
1.) I set the breakpoint at first executable statement in the subroutine (line: 23)
2.) the ESP was always constant at 0012B08C
3.) if the System.NullReferenceExeception occurred at line 42 the ESP was at 0012AF7C
I guess that is not an error if the stackpointer changes inside a subroutine?
------
To your question: After the error turned out, I disabled all internal write statements, except the one at line 42 in this module:
WRITE(strText,*) 234.45
where strText is a local variable declared with
CHARACTER*25 strText
0 Kudos
Steven_L_Intel1
Employee
1,016 Views
It is normal for the stack pointer to change during execution of a routine.
0 Kudos
oliverk
Beginner
1,016 Views

Hello Steve,

I still have my troubles with the internal write. I installed now the latest compiler version and I set my string variables (target and format string) to static (SAVE). But it doesn't help.

Does it help if I supply the debugger information as follows:

libifcoremd.dll!for_set_reentrancy() + 0x17f
libifcoremd.dll!for_set_reentrancy() + 0x31a
libifcoremd.dll!_fq_settextposition() + 0x7e9
libifcoremd.dll!for_write_int_fmt() + 0x23
>SiWaProGM.dll!OWS(TYPGRAFIKFENSTER * GRAFIK=0x100907e0, char [6]* FMTX=0x10090d4c) Zeile 41 + 0x72Fortran

0 Kudos
Steven_L_Intel1
Employee
1,016 Views
No, it doesn't help. We would need to see a complete program that demonstrates the problem.
0 Kudos
oliverk
Beginner
1,016 Views

I tried now to take the destination string variable(s) into/away the stack and declared them also as

CHARACTER, AUTOMATIC :: strText*25

but the error message keeps telling me:

System.NullReferenceException: Object reference not set to an instance of an object
I don not know now, where else to look for ...

Message Edited by OliverK on 05-16-200611:26 AM

0 Kudos
Steven_L_Intel1
Employee
1,016 Views
You need to debug this and have the debugger break when an access violation occurs. That is probably what is resulting in the error you are seeing. I don't think anyone here can help you more without seeing the code in question.
0 Kudos
oliverk
Beginner
1,016 Views

Finally after a lot of grey hairs more, I found the reason:

It was actually a statement

WRITE(strText,'(F5.2)') xmax

wherexmax = -1234.56

Thank you to all for your support

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,016 Views

It sounds as if strText is intended to be a Stack local variable.

Depending on options, the array of characters might get compiled as a static array.

Try adding ", automatic" to the declaration which will force it to be on the Stack.

Jim Dempsey

0 Kudos
Reply