It might be a problem with windows. In particular, windows has 3 semi-independent environment variables. Julia uses the Win32 API environment, but there are also two posix environ arrays (unicode and not unicode) that might be getting used by R. Additionally, some languages (such as Tk) make a copy of the environment upon startup in order to expose it as a normal string array in the language, making the problem even worse. ( https://msdn.microsoft.com/en-us/library/vstudio/stxk41x1(v=vs.110).aspx)
Sorry, but I'm guessing that none of that information really helps :( On Fri, May 8, 2015 at 10:12 AM Simon Byrne <[email protected]> wrote: > As a follow up, here's some code (which requires that R be installed): > > ENV["PATH"] = ENV["PATH"]*";C:\\Program Files\\R\\R-3.2.0\\bin\\x64\\" > const libR = "C:\\Program Files\\R\\R-3.2.0\\bin\\x64\\R.dll" > argv = ["REmbed"] > > println(ccall((:Rf_initEmbeddedR,libR),Cint,(Cint,Ptr{Ptr{Uint8}}),length(argv),argv)) > > > If I run this as a script, I get an error message (unable to load shared > library). However if I first set > > PATH=PATH;C:\Program Files\R\R-3.2.0\bin\x64 > > then run the script (from within the same command prompt session), the > error goes away. > > Any ideas? > > Simon > > > On Friday, 8 May 2015 09:55:29 UTC+1, Simon Byrne wrote: >> >> I'm trying to understand how ENV works (at least on Windows): >> >> I'm trying to ccall a library that requires a particular addition to >> "PATH". If I do this externally (through the Windows menus) it works okay, >> but not via ENV["PATH"]. I assume that this means that ENV only changes the >> local process? If so, is there anyway I can modify the system variable from >> within Julia? >> >> -Simon >> >
