[Gdal-dev] Re: Move gdal-DLLs? (C#)

Mateusz Loskot mateusz at loskot.net
Sun Aug 12 16:15:36 EDT 2007


Tomas R wrote:
> Thanks for the link, perhaps I have missed some information.
> 
> Can I set a system path from C# that will be searched (of course I can
> but how) that will not interfere with possible other processes  search
> path?


If you want to add FWTools bin folder to PATH during run-time,
so you don't have to pollute system PATH permanently,
you can do it this way, in C#

DllImport("kernel32.dll", CharSet=CharSet.Auto, SetLastError=true)]
public static extern bool
   SetEnvironmentVariable(string lpName, string lpValue);

string path = Environment.GetEnvironmentVariable("PATH");
path += @";C:\Program Files\FWTools\bin";
SetEnvironmentVariable("PATH", path);

Now, for current process, all DLLs from FWTools package are accessible.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Gdal-dev mailing list