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 on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

GETENV returning empty strings, Version 9.1

Dan_S_
Beginner
740 Views
The GETENV function as used below is returning empty strings after recompiling. I am using version 9.1. Here's the code:

use ifport
character*256 libstr
call getenv('LIB',libstr)
write(6,'(a,a)') 'lib=',trim(libstr)
end
With a previously compiled/linked version (9.0), I got this as output:

LIB=C:Program FilesIntelCompilerFortran9.1Ia32Lib; (etc)

I have found that calling the intrinsic routine "GET_ENVIRONMENT_VARIABLE" will work, but I
would like to know what is causing the problem with GETENV, in case it affects other
code I have that uses the portability library.

Any ideas?

0 Kudos
3 Replies
Steven_L_Intel1
Employee
740 Views
Works for me with 9.1.039. How many characters is the definition of your LIB variable? What happens if you increase the size of the character variable?
0 Kudos
Dan_S_
Beginner
740 Views
I tried that, but that didn't seem to be the problem.

After some experimenting, I've found the problem has something to do with environment strings that contain references to other strings. That is, GETENV will return most of my environment strings, but those strings like LIB which contain indirect references, like "%XPRESSDIR%lib;" are returned empty. In this case, I have another environment string, XPRESSDIR, that has the value "c:xpressmp" and it doesn't seem to be processed by GETENV when I asked for "LIB".



0 Kudos
Steven_L_Intel1
Employee
740 Views
I don't see that behavior with 9.1.039 - such strings are properly expanded. I see no difference between GETENV and GET_ENVIRONMENT_VARIABLE in this regard.
0 Kudos
Reply