No way for plugins to load with dependencies that are not in default libray search paths
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
The following emails describe the problem.
Hi All,
I have a Paraview plugin depending on some shared libraries that ParaView does not depend on. What's the best way to make Paraview know about this dependency so that it can find the required libraries when loading the plugin. Apparently, have all the required libraries in the same directory as the plugin does not seem to work on Windows. I am trying to accomplish this on both Windows and Mac. I assume this is a common scenario, but I did not find an answer in the mailing list.
Thanks
Yumin
I am having a similar issue on Windows with the VisIt database bridge plugin. My issues would be solved if the loader would search the plugin's directory. It would be even better if a list of paths relative to the plugin's directory could be provided, maybe via CMake or xml.
Burlen
Yumin Yuan wrote:
Thanks, Ken.
I guess the question then is who should be be doing all that. I assume/wish Paraview's load-plugin module will handle that, or at least know to look for libraries in that plugin's directory, which is most likely where people will put all the dependency libraries when they hand off their plugins to someone else.
Yumin
On Wed, Mar 4, 2009 at 3:17 PM, Moreland, Kenneth kmorel@sandia.gov wrote:
I believe the dependent shared libraries should be found exactly the same way as any other shared library. On Windows, it searches your PATH plus the directory the application is run in (not the one the plugin is located in). On Mac it searches DYLD_LIBRARY_PATH. In addition on Mac you can compile with rpath flags to hardcode the full path to dependent shared libraries.
On windows you can check the resolution of shared libraries using the depends tool (although you might get misleading results if it finds libraries in the current directory, I think). On Mac you can use otool with the –L flag.
-Ken
On 3/4/09 11:34 AM, "Yumin Yuan" yumin.yuan@kitware.com wrote:
Hi All,
I have a Paraview plugin depending on some shared libraries that ParaView does not depend on. What's the best way to make Paraview know about this dependency so that it can find the required libraries when loading the plugin. Apparently, have all the required libraries in the same directory as the plugin does not seem to work on Windows. I am trying to accomplish this on both Windows and Mac. I assume this is a common scenario, but I did not find an answer in the mailing list.
Thanks
Yumin
ParaQ-Developer mailing list ParaQ-Developer@paraview.org http://public.kitware.com/cgi-bin/mailman/listinfo/paraq-developer
**** Kenneth Moreland *** Sandia National Laboratories
*** *** *** email: kmorel@sandia.gov ** *** ** phone: (505) 844-8919 *** web: http://www.cs.unm.edu/~kmorel
also we could use
SetDllDirectory Function
Adds a directory to the search path used to locate DLLs for the application.
http://msdn.microsoft.com/en-us/library/ms686203(VS.85).aspx
Burlen Loring wrote:
John Biddiscombe wrote:
But unfortunately it's not really paraview's problem. It looks in the place it is told to and finds the plugin, but then undernesath that, windows uses the places it knows about (ie the PATH) to locate the dll's that are pulled in internally by the plugin. Currently the loader we are using, Utilities/kwsys/DynamicLoader.cxx, calls LoadLibrary on windows. If it were to instead call LoadLibraryEx we could use the LOAD_WITH_ALTERED_SEARCH_PATH flag to tell it where to look for dependencies.
http://msdn.microsoft.com/en-us/library/ms684179(VS.85).aspx
Looks like LoadLibraryEx is available from win 2k on.