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

Tomas R monshi at home.se
Sun Aug 12 16:37:09 EDT 2007


Mateusz Loskot skrev:
> 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
>   
Ohh, as simple as that  ;-)
If we then to this problem add that there is a possibility two plugins, 
two dll packages,  are active in SportTracks (one is the one I am 
developing) that both depends on GDAL but on different installations 
(possibly different versions). Will the path I set pollute the second 
plugins path? If we say that both plugins use the same method as in the 
example above and not have the DLLs in their local directory.
Should not be a problem I think, but without asking I can't know for sure.


Thanks!
Tomas




More information about the Gdal-dev mailing list