可以在同一个DLL的数据由2个不同的进程共享?

编程入门 行业动态 更新时间:2024-10-24 16:22:07
本文介绍了可以在同一个DLL的数据由2个不同的进程共享?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有在同一时间运行两个不同的C#应用​​程序。

I have two different C# applications that are running at the same time.

我想他们两个是能够访问的同一个实例 DLL(也是在C#)。

I would like both of them to be able to access the same "instance" of a DLL (also in C#).

该DLL包含一些数据,我想回到这两个应用程序的为准自讨苦吃。

The DLL holds some data that I'd like to return to whichever of the two applications is asking for it.

我的DLL是线程安全的,所以我希望这将是可能的,但我不知道怎么样。

My DLL is thread-safe so I was hoping this would be possible but I'm not sure how.

任何帮助或建议将不胜感激。

Any help or advice would be much appreciated.

推荐答案

的进程空间将是不同的,因此,例如,在DLL中的全局变量将是具体的每个单独的过程。可能的是在存储器中的代码将被共享(视窗通常使用的引用计数,使该部分更有效)。

The process space will be different so, for example, global variables in the DLL will be specific to each separate process. It is possible that the code in memory will be shared (Windows typically uses reference counting to make that part more efficient).

如果你想要共享该被访问信息在这两个过程之间的DLL中,然后它可能似乎有必要使用某种IPC(进程间通信)机制,如套接字,共享存储器,管等的

If you are wanting to share information that is accessed in the DLL between the two processes, then it seems likely that it will be necessary to use some kind of IPC (interprocess communication) mechanism such as sockets, shared memory, pipes, etc.

更多推荐

可以在同一个DLL的数据由2个不同的进程共享?

本文发布于:2023-11-06 22:45:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564878.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:进程   数据   在同一个   DLL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!