Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Ankündigungen
Important Update: Community Platform Migration​. Learn more​>

lnblnk

gregr
Einsteiger
2.088Aufrufe
I finally found lnblnk in libpepcf90mt.lib. When i tried to use it it promptly blew up. So i pasted the "interface" from the intel manual:

INTERFACE

INTEGER(4) FUNCTION LNBLNK(STRING)

!MS$ATTRIBUTES ALIAS:'lnblnk_'::LNBLNK

CHARACTER(LEN=*), INTENT(IN) :: STRING

END FUNCTION

END INTERFACE

Into my code. It doesn't blow anymore but it returns the length of the string instead of the position of the last non-blank character. I looked at the string in hex, there is no null at the end, it's definitely got blanks from character 12 to the end of the string.

Please help, i don't want to have to go back to writing my own routines for stuff that ought to just work. I really don't understand why i had to find these in a library, they are *inline* functions, no?

Thanks,

Greg

PS i'm using Intel fortran 7.0.

Message Edited by [email protected] on 07-28-2004 09:30 AM

0 Kudos
5 Antworten
Steven_L_Intel1
Mitarbeiter
2.088Aufrufe
No - LNBLNK is a "Portability Library" routine, it is not a compiler intrinsic.
I tried the following code in 7.1 and 8.0 and got 7 returned in both cases:
Code:
use iflport
character*10 string
integer i
string = 'A B C D'
i = lnblnk(string)
write (*,*) i
end
I note that in 7.1, I needed to build with /4Yportlib to pull in the portability library - that is not needed in 8.0.
sgongola
Einsteiger
2.088Aufrufe
You meant:
use ifport
Steven_L_Intel1
Mitarbeiter
2.088Aufrufe
No, I didn't. In 7.1, one had to say "use iflport". 8.0 accepts either.
gregr
Einsteiger
2.088Aufrufe
Ok, thanks, i'll keep thrashin with it.
Greg
gregr
Einsteiger
2.088Aufrufe
Ok, here's what the deal was. The string i was lnblnking came from another of my C routines. I had a get_environment routine which called the C getenv which filled in that string i was lnblnking. I swear, there was no null (that the debugger showed me, i looked at it in hex) in that string, but something about it confused the Fortran support lib.
Antworten