Open kaby76 opened 7 years ago
Note, https://github.com/NETMF/Llvm.NET.git , which has been updated within the last 6 months, is not the same, although identically named, and not released in NuGet.org.
LLVMDLL.Load is platform dependent (uses kernel32.dll). https://bitbucket.org/lost/native/src/8ad3850680dd1094baa1c61268c14e9b88d8532f/DynamicLibrary.cs?at=default&fileviewer=file-view-default
'Environment.SetEnvironmentVariable("PATH", path);' works.
According to https://www.nuget.org/packages/LLVM/ (and https://www.nuget.org/packages/LLVM.NativeLibrary/ ), "To get the native library itself, you can reference LLVM.NativeLibrary from NuGet, and call LLVMDLL.Load. This will preload an LLVM DLL that matches your current processor architecture." However, if you clone these libraries, there is no LLVMDLL.Load(). But, the concept is sound.
To do: add code that will select the appropriate native runtime based on the host running, and avoid the problematic request to the user to copy the native library over. This seems to be done already in Mono/Xamarin/Android where the system does that, and outputs the search for the appropriate runtime. To do that, a call to SetEnvironmentVariable() or SetDllDirectory() must be done prior to the function call. See https://stackoverflow.com/questions/2864673/specify-the-search-path-for-dllimport-in-net or https://msdn.microsoft.com/en-us/library/ms686203.aspx?f=255&MSPPError=-2147217396 .