如何在C#中获取dll的内存地址? [英] how can i get a memory address of dll in C# ?

查看:412
本文介绍了如何在C#中获取dll的内存地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在C#程序中获取dll的内存地址?

how can i get a memory address of dll in C# program?

推荐答案

dll是一个动态链接库。它没有内存位置。在应用程序中使用dll时,内存将用于dll使用的变量等。


考虑到这一点,请再次解释您的问题,因为您的问题没有意义。


-Frinny
A dll is a Dynamic-link library. It does not have a memory location. When you use the dll in your application, memory will be used for the variables etc that the dll uses.

With this in mind, please explain your problem again because your question does not make sense.

-Frinny


ops,是的我很抱歉。


当我调用一个dll函数时会在该dll中设置一个值。

ex:void Set(char x)


如何获得该值的内存地址?


i想要在C#程序中获取该地址。
ops , yes i''m sorry about that.

when i call a dll function that will set a value in that dll.

ex : void Set(char x)

how can i get the memory address of that value ?

i want to get that address in a C# program.


如果void Set(char x)是C#,那么它在内存中没有常量地址。 .NET垃圾收集器会将其移动到内存中,您不能认为它将位于一个位置。有一种方法可以锁定变量在内存中的位置,并使用Interop函数获取其真实地址。

你能更清楚地描述你的任务吗?
If void Set(char x) is C# then it does not have a constant address in the memory. The .NET garbage collector will move it around memory and you cannot assume that it will be at one location. There is a way to lock position of the variable in the memory and get its real address using Interop functions.
Can you describe your task more clear?


这篇关于如何在C#中获取dll的内存地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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