- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						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
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?
Link Copied
		3 Replies
	
		
		
			
			
			
					
	
			- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						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?
					
				
			
			
				
			
			
			
			
			
			
			
		
		
		
	
	
	
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						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".
					
				
			
			
				
			
			
			
			
			
			
			
		
		
		
	
	
	
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".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
			
				
					
					
						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.
					
				
			
			
				
			
			
			
			
			
			
			
		
		
		
	
	
	
 
					
				
				
			
		
					
					Reply
					
						
	
		
				
				
				
					
						
					
				
					
				
				
				
				
			
			Topic Options
			
				
					
	
			
		
	- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
