Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs have moved to the Altera Community. Existing Intel Community members can sign in with their current credentials.

lnblnk

gregr
Beginner
1,104 Views
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 gregr@scientech.com on 07-28-2004 09:30 AM

0 Kudos
5 Replies
Steven_L_Intel1
Employee
1,104 Views
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.
0 Kudos
sgongola
Beginner
1,104 Views
You meant:
use ifport
0 Kudos
Steven_L_Intel1
Employee
1,104 Views
No, I didn't. In 7.1, one had to say "use iflport". 8.0 accepts either.
0 Kudos
gregr
Beginner
1,104 Views
Ok, thanks, i'll keep thrashin with it.
Greg
0 Kudos
gregr
Beginner
1,104 Views
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.
0 Kudos
Reply