I have problems understanding how to work with external dlls/dylibs file in my Xojo project.
I’m using soft declares to functions of an external dll/dylib file, both on Windows and Mac. On Mac my app can find and use the dylib file if I use the full path to the file, e.g. /Users/username/projects/xojoapp/mylib.dylib. On Windows it only works if I place the dll file into the C:\windws folder.
I can’t imagine that this is the recommended way to handle external libraries. What is the best/usual way to store (and later deploy) external libraries and use them during development (just click the Run button in Xojo) and build/deploy?
The only way I see to achieve that would be to run a .Bat file containing the line you posted. Not shell to it. Point a folderItem to it and do a launch. That way it will be added to the system variables.
On Windows be aware that this will overwrite everything in the PATH variable, which might cause problems. It’s better to append/prepend (ordering is significant) your custom directory to the variable rather than overwrite:
Dim s As String = System.EnvironmentVariable("PATH")
System.EnvironmentVariable("PATH") = s + ";" + pathToSubfolder //searched LAST
// OR
System.EnvironmentVariable("PATH") = pathToSubfolder + ";" + s //searched FIRST
[quote=367157:@Andrew Lambert]On Windows be aware that this will overwrite everything in the PATH variable, which might cause problems. It’s better to append/prepend (ordering is significant) your custom directory to the variable rather than overwrite:
Dim s As String = System.EnvironmentVariable("PATH")
System.EnvironmentVariable("PATH") = s + ";" + pathToSubfolder //searched LAST
// OR
System.EnvironmentVariable("PATH") = pathToSubfolder + ";" + s //searched FIRST[/quote]
Good point, I had problems with PATH being too long to append to and I did not need to look in other locations so this was fine for me. Note this will only effect your running application.