c++ - Maintaining common source code for 32/64 bit build and use the correct libs -
environment: visual studio 2008 professional
we porting our 32 bit windows application 64 bit. our application uses number of microsoft dlls htmlhelp.dll. added import libraries project.
now have 32 , 64 bit version of htmlhelp.lib (surprisingly both have same name). why ms gave them same name. how application select right .lib current build platform.
looking general guideline handle type of situation.
put them in different directories : how use correct unmanaged dll file according cpu architecture? (32 / 64 bits)
the setdlldirectory function affects subsequent calls loadlibrary , loadlibraryex functions. disables safe dll search mode while specified directory in search path.
after calling setdlldirectory, standard dll search path is:
the directory application loaded. directory specified lppathname parameter. system directory. use getsystemdirectory function path of directory. name of directory system32. 16-bit system directory. there no function obtains path of directory, searched. name of directory
is system. windows directory. use getwindowsdirectory function path of directory. directories listed in path environment variable.
each time setdlldirectory function called, replaces directory specified in previous setdlldirectory call. specify more 1 directory, use adddlldirectory function , call loadlibraryex load_library_search_user_dirs.
to revert standard search path used loadlibrary , loadlibraryex, call setdlldirectory null. restores safe dll search mode based on safedllsearchmode registry value.
to compile application uses function, define _win32_winnt 0x0502 or later. more information, see using windows headers.
i use same technique cross-plateforms build scripts :
# os-dependant tools , files ifeq ($(os), windows_nt) arch = win else arch = linux endif tmp := tmp_$(arch) lib := lib_$(arch) bin := bin_$(arch)
in visualstudio, create debug , release build configuration each architecture, , point working directory (where put dll) accordingly.
Comments
Post a Comment