- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
I have a IVF10 DLL that is the calculation engine for a frontend application written in VB.NET 2005.
I've noticed that when I pass a Boolean/Logical from VB.NET to IVF10 as part of an argument list, when I try to evaluate it it only evaluates correctly if I type it without the "dots" before and after the TRUE.
IF ( BVAR.EQ.TRUE ) THEN
BVAR is declared this way:
LOGICAL*2, INTENT(IN) :: BVAR
And on the VB.NET side BVAR is declared this way:
Dim bVar as Boolean
However, if I declare a variable that exists solely withing the IVF10 DLL and assign it's value from with the DLL, rather that having its value passed from VB.NET, then the "dots" are necessary or it won't evaluate correctly.
IF ( CVAR.EQ..TRUE. ) THEN
CVAR is declared this way:
LOGICAL*2 CVAR
Can anyone please shed some light on this behavior? Thanks in advance.
I've noticed that when I pass a Boolean/Logical from VB.NET to IVF10 as part of an argument list, when I try to evaluate it it only evaluates correctly if I type it without the "dots" before and after the TRUE.
IF ( BVAR.EQ.TRUE ) THEN
BVAR is declared this way:
LOGICAL*2, INTENT(IN) :: BVAR
And on the VB.NET side BVAR is declared this way:
Dim bVar as Boolean
However, if I declare a variable that exists solely withing the IVF10 DLL and assign it's value from with the DLL, rather that having its value passed from VB.NET, then the "dots" are necessary or it won't evaluate correctly.
IF ( CVAR.EQ..TRUE. ) THEN
CVAR is declared this way:
LOGICAL*2 CVAR
Can anyone please shed some light on this behavior? Thanks in advance.
コピーされたリンク
1 返信
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Very simply, VB (and C/C++) boolean is NOT the same as Fortran LOGICAL. Rather, it is an integer type and should be treated as such. Do not use logical operators on boolean values. You can, as you found, compare them to the integer values TRUE (1) and FALSE (0) defined in module IFWINTY, though for correctness the test should be 0=false, non-zero=true.
IFWINTY defines a BOOL kind value so you can declare these as INTEGER(BOOL).
For more information, see this article I wrote about the LOGICAL type.
IFWINTY defines a BOOL kind value so you can declare these as INTEGER(BOOL).
For more information, see this article I wrote about the LOGICAL type.
