Merging/Bundling DLL/LIBs (C++/Java)
We currently use a software product which releases both dll and lib files for their software (they do not give us the source code). 开发者_JAVA百科 Their files were written in C. We write a dll wrapper for their software in C++ (using VS2010) and export all dlls to a java project. We then load all the dlls in Java using System.loadLibrary() calls. Everything works as expected.
The issue is that the software company will release a 'newer' version of the software (Ex v1.0, v2.5, etc), and the names of their dll's are identical even though the versions are different. So we encounter errors in Java using the System.loadLibrary() calls because it doesn't know which one to reference (since they are all named the same).
I could see explicitly setting the VM args to point to a specific lib folder which contains the version we want (ex: -Djava.library.path=lib\v1_0). The issue with that is we need to run ALL versions during the same java application (Ex: v1.0, v2.5, etc).
So my best guess is to try and bundle/merge the dlls so we only release 1 dll per version(containing our wrapper dll and all their dlls or libs), and that dll will be uniquely named. Does anyone know how to do this or have a better way they can suggest?
Thanks!
Use Maven with the Maven NAR Plugin to manage the dependency hell.
精彩评论