[osg-submissions] Plugin DLL search order fix for Win32

Luigi Calori l.calori at cineca.it
Fri Aug 24 02:15:16 PDT 2007


Robert Osfield wrote:

>Hi Luigi,
>
>On 8/24/07, Luigi Calori <l.calori at cineca.it> wrote:
>  
>
>>1)
>> it is designed to search anyway for system and current directory before
>>PATH defined folders: this prevet an application writer to
>>set PATH env var to override presence of system installed  plugins.
>>Would not be better to reverse the order?
>>like
>><application_folder>/osgPlugins<osgversion> ;
>><PATH_folder>/osgPlugins<osgversion>; .....
>><PATH_folder>/osgPlugins<osgversion>;<SYSTEM_folder>/osgPlugins<osgversion>;<CurrDir_folder>/osgPlugins<osgversion>;
>>    
>>
>
>It'd be worth posting this suggestion to osg-users for general
>discussion.  For a point of reference, I believe J-S implemented the
>spec according to Microsoft docs of lib search paths, the new code in
>FileUtils.cpp documents this well.
>
>  
>
I' ll post on osg-users,

>>2)
>>in VisualStudio builds, the projects appends /Debug or /Release to the
>>folders where dll are created at build time,
>> I was used to test osg build BEFORE installing by setting up PATH
>>environment to build folders.
>>With current enforced versioned plugin this is impossible as projects
>>place plugin dll in lib/osgPlugins<osgversion>/<Debug or Release>
>> I attach a patch that change the build folder placement to lib/<Debug
>>or Release>/osgPlugins<osgversion>
>>that seems also more consistent.
>>The patch should not affect other platform builds
>>    
>>
>
>Before I go ahead and merge, could you say how the rest of the libs
>are distributed?
>  
>
lib/<Debug>/osgd.dll
lib/<Debug>/osgViewerd.dll
....
lib/osgPlugins<osgversion>/osgdb_osgd.dll
lib/osgPlugins<osgversion>/osgdb_ived.dll
....

>I do wonder if it wouldn't be possible to build both the release and
>debug plugins into the same directory as the debug plugins all have a
>d postfix so there won't be any overlap.
>  
>
I' ll try a hack that have been suggestd on CMake user list to do that, 
prepending ../Debug to target name, using ../ is not considered the 
cleanest solution,thoug.
If you think it would be viable, I can try to se if it works.

>Also is there any way to get the plugins directory to go into the bin
>directory under Windows/MSVC?  I presume CMake adds the lib
>automatically.  Is there any way such as using ../bin/ preprending the
>target to fool it in doing what we want?
>
>  
>
I already tested it, it can be easily done, the only problem is name 
clashing pr .pdb files that VS produce:
osviewer is both a library (.dll and .lib) as well as an executable 
(.exe) the corresponding .pdb file (debug info for VisualStudio) have 
the same name osgviewer.pdb for both the application as the library
The sam happen for osgtext and osgmanipulator
In order to properly build debug under the same bin folder is required 
to resolve the clashing. my solution was to append _exe to the .exe 
names (like osgviewer.exe --> osgviewer_exe.exe)
I agree having windows build stuff all in the same bin folder   would 
help running  "out of the box" without adding lib/Debug to PATH and 
without installing

>My hope would be that we can build libs and bins all in roughly the
>right place, without needing to install.
>  
>
If the design seems you to fit, let me know, I can try to test the 
"one-folder" build layout.

Luigi


More information about the osg-submissions mailing list