A way to load DLL from central repository

后端 未结 6 1403
青春惊慌失措
青春惊慌失措 2020-12-31 11:57

We have lot of products and there are some common DLLs across each product\'s application. Right now we copy each common DLL into each product\'s bin directory and treat the

6条回答
  •  情歌与酒
    2020-12-31 12:18

    This may not help you, but... you CAN load dlls from arbitrary directories AND still rely on normal dynamic linking to them as long as you can control when the dlls are loaded via dynamic linking and ensure that you've already loaded the dll explicitly using a full path before it's loaded dynamically.

    This is only likely to be of help if you're writing a plugin system where your plugins are dynamically linked to dlls which you wish to keep in a non standard directory. If you then know all about the dlls they're linked to you can explicitly load these dlls directly using their full path before you load the dlls (plugins) that depend on them dynamically. Since the dll is already in memory when your plugin needs to locate it it will use the version in memory. You can the unload the explicit load that you did before loading the plugin and you're good to go.

    Unfortunately this wont work if your main exe needs to load dlls from arbitrary places as you cant get in ahead of the normal dll load process.

提交回复
热议问题