- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm just curious - how does SETENVQQ work? What interests me in particular is callingSETENVQQ("FOR_DISABLE_DIAGNOSTIC_DISPLAY=T") frommy Fortran DLL.
The important piece of info is that I'm using C++/CLI in VS2008to interface with the Fortran dll - there seems to be quite a few problems with this combo.
If I use SETENVQQ in a x64 configuration, it works great.
If I use SETENVQQ in a Win32 configuration, it doesn't work. Instead, I have to do this:
Then I load my .dll, which in turn loads the Intel libraries. This works evenif I don't subsequently callSETENVQQ. (For the sakes of completeness, I've been testing with divide-by-zero crashes, after setting the appropriate FPflags).
The important piece of info is that I'm using C++/CLI in VS2008to interface with the Fortran dll - there seems to be quite a few problems with this combo.
If I use SETENVQQ in a x64 configuration, it works great.
If I use SETENVQQ in a Win32 configuration, it doesn't work. Instead, I have to do this:
[cpp] int iRetVal; iRetVal=_wputenv_s(L"FOR_DIAGNOSTIC_LOG_FILE",szTracebackFile); //iRetVal 0 means OK iRetVal=_wputenv_s(L"FOR_DISABLE_DIAGNOSTIC_DISPLAY",L"T"); //iRetVal 0 means OK //_wputenv_s(L"TBK_ENABLE_VERBOSE_STACK_TRACE",L"F"); iRetVal=SetEnvironmentVariableW(L"FOR_DIAGNOSTIC_LOG_FILE",szTracebackFile); //iRetVal 0 means not OK iRetVal=SetEnvironmentVariableW(L"FOR_DISABLE_DIAGNOSTIC_DISPLAY",L"T"); //iRetVal 0 means not OK [/cpp]
Then I load my .dll, which in turn loads the Intel libraries. This works evenif I don't subsequently callSETENVQQ. (For the sakes of completeness, I've been testing with divide-by-zero crashes, after setting the appropriate FPflags).
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I know, it just calls C's "setenv" to set the variable in the current process. If the Fortran support library DLL loads before you call SETENVQQ, then it may not have the effect you desire.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I did call SETENVQQ from the Fortran .dll, so the Fortran library would have to beloaded when I called SETENVQQ.
One unusual thing I noticed though, 2 hours into stepping through Win32(dis)assembly - it seemed like Fortran runtime had its own copy of the _environstrings. Does that sound right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not familiar with the internals of the C++ libraries, but this might make sense. The Fortran DLL libraries statically link the C++ libraries - we had to do this to make it work with all three VS versions.

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