(This is more generic advice with dll issues with Julia. If I get R installed, I'll try the exact situation.)
Windows SetDllDirectory issues
I was getting a similar issue with PyInstaller calling another language. It ended up being related to a call to SetDllDirectory in PyInstaller that modified the search path in an odd way.
https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setdlldirectorya
https://github.com/pyinstaller/pyinstaller/wiki/Recipe-subprocess#windows-dll-loading-order
To fix it, I just had to tell python to reset SetDllDirectory back to NULL. I'm not entirely sure of the equivalent in R.
SysInternals ListDlls
When debugging what dlls are getting loaded, I am a huge fan of this tool offered by SysInternals. Download it, and run it with ListDlls.exe julia or ListDlls.exe R while julia or R is running.
https://docs.microsoft.com/en-us/sysinternals/downloads/listdlls
R dyn.load documentation
It also sounds like R tries to do a lot of things to find dlls if you load in a 3rd party dll, especially on Windows.
https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/dyn.load
The ‘standard mechanisms for loading DLLs’ include a search order for
where a DLL is found (if not given as an absolute path, which is
preferred), and of where its dependent DLLs will be found. This search
path depends on the version of Windows and its security settings, but
for versions since Windows XP SP1 it is
The directory from which the application was launched.
The various system directories, e.g.c:/Windows/system32,
c:/Windows/system and c:/Windows.
The current directory.
Along the search path for executables given by the environment
variable PATH.
Packages often want to supply dependent DLLs in their libs directory,
and do this by setting the PATH variable (library.dynam does that
automatically in recent versions of R), but the DLL search order means
that DLLs in the launch directory and in system directories will be
preferred. On Windows XP SP1 and later there is a way to modify the
search order. If argument DLLpath is supplied to dyn.load, the latter
makes use of the Windows system call SetDllDirectory to insert the
value of DLLpath in second place, and removes the current directory,
for the duration of that dyn.load call. (Note that only one directory
can be inserted in this way.)
Users have been confused by messages like
error: unable to load shared object
'.../library/rJava/libs/x64/rJava.dll':
LoadLibrary failure: The specified module could not be found.
The final line is a Windows (not
R) diagnostic: the ‘module’ that could not be found is not rJava.dll
but something else Windows is looking for (here most likely Java
DLLs): if you are lucky there will be a dialog box with more details.
How Julia Loads Sys.dll
Julia 1.x current loads some dlls from the folder where the exe is in bin/ and it also loads sys.dll from a nearby folder: ../lib/julia/sys.dll . You can override this by specifying where sys.dll is with the -J argument when calling julia.
Hope that helps.
julia_setupmy R session is immediately aborted - Mike