在C#中创建应用程序之间的共享内存。 *。也许吧? [英] Creating shared memory between applications in C#. *.dll perhaps?

查看:74
本文介绍了在C#中创建应用程序之间的共享内存。 *。也许吧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好。首先,我是dll编码的新手(意思是今晚),我需要能够共享一个List< bool>和列表< double>在我的主应用程序和其他可以间接与它接口的应用程序之间。


基本上mian程序将初始化dll并传入所有值。然后每隔约50ms左右,新的值将被赋予dll。我创建了一个基本的dll,我可以将值发送到dll中的全局列表,但我的问题来自于我猜Windows为每个dll实例创建了新的内存块,所以我的主应用程序与dll通信,测试应用程序与dll通信,但两者都没有相同的值,所以他们不能互相说话。


我的问题来自于我从不使用或实现与共享内存有关的任何事情。我甚至不确定我是否在正确的轨道上。关键字是stackalloc吗?与此有什么关系?


Justto提供了更多背景知识,基本上我开发了一些硬件,可以通过原始字节流来说明我的应用程序。然后程序将该字节流解释为双精度和bool。所以我的应用程序使用它们很好然而,其他人想要将他们的程序与硬件接口,但不是重新解码流,而是从某个地方的dll中获取值。


如果需要,我可以澄清更多。

解决方案

有人有什么建议吗?


在我看来,你混淆了很多概念。我建议在开始这样一个项目之前回到基础知识并学习基础知识。



在我看来,你混淆了许多概念。我建议在开始这样一个项目之前回到基础知识并学习基础知识。



我只是不知道我要搜索的是什么。我可以让C#应用程序自己没问题。问题是现在其他人想通过dll使用获取值来与这个程序接口。


我从来没有写过dll,但是我只写了1对于基本没用这个应用程序,但只是为了了解它们是如何组合在一起的。我的理解是,需要为1个dll共享内存以连接2个程序。这就是我要问的全部。


相信我说我非常精通C#基础知识和中级理解。实际的幕后发生的事情我知道一些,但我正在学习更多。这将属于最后一类,因为它不是一个标准的事情。


通过谷歌搜索,我遇到了一些对stackalloc的引用,我在与一个字节接口时简要使用了它流。我认为它可能适用于这种情况。


硬件和我的软件都已经设计/编码。这个第三方应用程序的dll是我需要帮助的。


再次,有人知道在尝试在两个应用程序之间共享变量时要搜索的关键字吗?


hello. First off, I am very new to dll coding (meaning tonight) and I need to be able to share a List<bool> and a List<double> between my main application and other applications that can interface indirectly with it.

Basically The mian program will initalize the dll and pass in all the values. Then every about 50ms or so, new values will be given to the dll. I made a basic dll that I can send values to a global list in the dll, but my problem comes from I guess windows creates new memory blocks for each instance of the dll or something, so the my main application communicates with the dll, and the test application communicates with the dll, but neither have the same values, so they cannot speak to eachother.

My problem comes from me never using or implementing anything having to do with shared memory. I am not even sure if I am on the correct track. Would the keyword "stackalloc" have anything to do with this?

Justto give some more background, basically I developed some hardware that speaks to my application with a raw byte stream. Then the program interprets that byte stream into doubles and bools. So my application uses them fine. However others would like to interface their program with the hardware, but instead of re-decoding the stream, just grab the values from a dll somewhere.

I can clarify more if neccessary.

解决方案

anybody have any suggestions?


To my mind you have confused a number of concepts. I suggest getting back to basics and learning the fundamentals before starting such a project.


To my mind you have confused a number of concepts. I suggest getting back to basics and learning the fundamentals before starting such a project.

I just dont know what it is called that I am searching for. I can make C# applications no problem by themselves. The problem is now others want to interface with this program through the use of gettings values through a dll.

I have never written a dll, but I just wrote 1 that is basically useless for this application, but just to learn how they were put together. My understanding is that there needs to be shared memory for 1 dll to interface 2 programs. That is all I am asking.

Believe me in saying I am very proficient in C# basics and intermediate understandings. The actual "what goes on behind the scenes" I know some of, but I am learning more of. This would fall into the last category because it is not a standard thing to do.

Through googling, I came accross a few references to stackalloc which I have briefly used when interfacing with a byte stream. I thought it might have some applicability to this scenario.

And the hardware and my software are both already designed/coded. This dll for 3rd party apps, is what I need some help with.

So again, does anybody know what keyword to search for when trying to share a variable between 2 applications?


这篇关于在C#中创建应用程序之间的共享内存。 *。也许吧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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