什么是一个全球性的方法? [英] What's a global method?

查看:106
本文介绍了什么是一个全球性的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是.NET一个全球性的方法?我说的是由<创建的那些href="http://msdn.microsoft.com/en-us/library/67s2c85d.aspx"><$c$c>ModuleBuilder.DefineGlobalMethod方法。

What is a global method in .net? I'm talking about the ones created by the ModuleBuilder.DefineGlobalMethod method.

可这些方法从C#或其他.NET语言叫什么名字?

Can these methods be called from C# or other .net languages?

推荐答案

很难谈论这在所有熟悉的术语,这种能力是不是在所有裸露在C#或VB.NET语言。然而,C ++ / CLI编译器使用它。它显示像程序Ildasm.exe或反思反汇编的方式也是不规范的。

Hard to talk about this at all in familiar terms, this capability is not at all exposed in the C# or VB.NET languages. The C++/CLI compiler uses it however. The way it is shown in disassemblers like Ildasm.exe or Reflector is also not standardized.

也许最好的角反射器,看看,看看在System.Data.dll中装配。模块&GT; 节点 - (在反射器),&LT它是一个未命名的命名空间。你看那里的.cctor是一个模块initiailizer。同一种类的动物作为一个静态类的构造函数,但在模块级。它运行时组件被加载。 C ++ / CLI使用它来初始化C运行时库。

Perhaps the best angle is Reflector, take a look-see at the System.Data.dll assembly. It is in an unnamed namespace ("-" in Reflector), <Module> node. The .cctor you see there is a module initiailizer. Same kind of animal as a static class constructor but at the module level. It runs when the assembly gets loaded. C++/CLI uses it to initialize the C runtime library.

在___ CxxCallUnwindDtor()方法,你会发现有一个全球方法的一个例子。在C ++ / CLI语言并没有给任何办法,使这几样功能公众,他们总是嵌入在内部访问的元数据。并因此不能直接从C#或VB.NET程序中调用。我还没有发挥足够的与ModuleBuilder知道是否可以与被搞砸都超出了C ++ / CLI一样。这是所有的非常的模糊不清,实际上并没有那么有用。

The ___CxxCallUnwindDtor() method you find there is an example of a "global method". The C++/CLI language doesn't give any way to make these kind of functions public, they are always embedded in the metadata with internal accessibility. And can thus not be called directly from a C# or VB.NET program. I haven't played enough with ModuleBuilder to know if that can be messed with at all beyond what C++/CLI does. This is all very obscure and not actually that useful.

这篇关于什么是一个全球性的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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