Groups | Blog | Home
all groups > dotnet interop > december 2003 >

dotnet interop : Interop Environment Variables Problem


Phil Wilson
12/31/2003 11:15:54 AM
It's my understanding that a copy of the environment variables gets passed once
to a process when it starts, so the DLL is always seeing the same copy. That's
Windows behavior, nothing to do with interop or .NET.
--
Phil Wilson [MVP Windows Installer]
----
[quoted text, click to view]

Ali Hon-Anderson
12/31/2003 1:42:42 PM
I have a C# web application that is "passing parameters" to a DLL via
environment variables (that is how the DLL was written to receive
arguments). The problem is that the DLL seems to be taking the first set of
environment variables I set in my C# code and saving them. Subsequent calls
to the DLL with new environment variables all end up with the first set of
variables.



Is the Interop assembly really "linking" or "shadowing" the initial object?
What can I do to work around this?!!?



Thank you.

Alioop
12/31/2003 3:52:15 PM
Just wanted to clarify...

The IIS process is calling an instantiated Active X DLL. The first time,
environment variables are set and then first instantiated copy of the Active
X DLL picks up the environment variables.

The next time another instantiation is done for the Active X DLL, new
environment variables are set, but the prior environment variables are
picked up by the second Active X object.



[quoted text, click to view]

Phil Wilson
1/1/2004 1:13:30 PM
But that's because environment variables are passed once to the process,
IIS, and after that it doesn't matter how many times a DLL is loaded into
the process because the process still has the same set of environment
variables as when it started. It's potentially even worse than that if you
are hosted from the IIS service because Windows Services don't pick up new
copies of environment variables until after a reboot. The thread "Updating
the System Path and IIS 6" in ...platformsdk.msi starting 12/18/2003 has
more on this.
--
Phil Wilson
[MVP Windows Installer]
[quoted text, click to view]

AddThis Social Bookmark Button