(Windows)如何使插件自动更新功能? [英] (Windows) How to make auto-update function for plugin?

查看:455
本文介绍了(Windows)如何使插件自动更新功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题。我正在为一个应用程序(.exe)编写一个插件(.dll)。我想为我的插件编写自动更新功能,但是我遇到了一个问题,它不能应用。因为我的插件在应用程序运行时加载,在运行时它不能替换。它只适用于应用程序退出。那么我该怎么办?



这是我的代码: http ://codepad.org/4a22ccMa



谢谢!

解决方案>

(这回答原来的问题已被编辑成完全不同)



这取决于操作系统我想可能是Windows,因为你说的是​​DLL;在Linux上你有共享对象(在 ELF )具有不同的语义)。阅读Levine的书籍 链接器和装载机



您可以阅读有关动态软件更新的更多信息。这是一个具有很多科学文献的整个研究课题。阅读例如关于 的文章Kitsune:高效的通用动态软件更新对于C (至少要了解您的问题中的几个问题)。



在Linux上,您可以重命名(2)旧的 .so dlopen(3)新的(可能 dlclose 较旧的,但是应该稍后再执行,当在调用堆栈指向旧插件)和我的 manydl.c 示例显示,您实际上可以在共享对象中实际上可以 dlopen (实际上超过一百万)。



在Windows上(我不知道)你可能需要动态加载不同的插件的新版本 文件路径。可能,在插件更新后重新启动程序应该使事情变得更加容易。



(如果你负担得起,切换到Linux可能是非常有帮助的,因为我请注意,在某些语言(和其中的一些实现)中,替换一些代码比在C或C ++中更容易,因为它更容易)



<视窗。我想在 CLR 托管代码,例如C#)或 JVM (例如在Java,Scala,Clojure)应该更容易。而在 Common Lisp (至少与 SBCL )很简单(特别是因为Common Lisp是一个同性恋语言)。



照顾继续,即调用堆栈。你会明白你的问题(也与正交的持久性& 应用程序检查点)比你想象的要深入和困难。升级课程及其实例也很困难。


I have a question. I'm writing a plugin (.dll) for an application (.exe). And I want to code auto-update function for my plugin but I catched an issue, it could not apply. Because my plugin has loaded while application is running, in run-time it cannot replace. It just apply until application has exited. So, how can I do it?

This is my code: http://codepad.org/4a22ccMa

Thanks!

解决方案

(this answers the original question, which has been edited to something completely different)

It depends upon the operating system (which I guess might be Windows, since you speak of DLLs; on Linux you have shared objects (in ELF) with a different semantics). Read Levine's book Linkers and Loaders.

You might read more about Dynamic Software Updates. This is a entire research subject with a lot of scientific literature about it. Read e.g. the paper about Kitsune: Efficient, General-purpose Dynamic Software Updating for C (at least to understand several issues in your question).

On Linux, you could rename(2) the old .so and dlopen(3) the new one (and probably dlclose the older one, but you should do that later, when no active call frame on the call stack points into the old plugin), and my manydl.c example shows that you practically can dlopen a big lot (more than a million in practice) of shared objects.

On Windows (which I don't know) you probably need to dynamically load the new version of the plugin in a different file path. Probably, restarting your program after a plugin update should make things much easier.

(if you can afford that, switching to Linux might be very helpful, because I guess that it is much easier)

Notice that in some languages (and some of their implementations) replacing some code is much easier than in C or C++ on Windows. I guess that in CLR (managed code, e.g. in C#) or in a JVM (e.g. in Java, Scala, Clojure) it should be easier. And in Common Lisp (at least with SBCL) it is quite easy (in particular since Common Lisp is an homoiconic language).

Take care of the continuation, i.e. of the call stack. You'll understand that your question (also related to orthogonal persistence & application checkpointing) is much deeper and more difficult than you have imagined. And upgrading classes and their instances is also very difficult.

这篇关于(Windows)如何使插件自动更新功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆