• <tfoot id='6GASe'></tfoot>

    <small id='6GASe'></small><noframes id='6GASe'>

    1. <i id='6GASe'><tr id='6GASe'><dt id='6GASe'><q id='6GASe'><span id='6GASe'><b id='6GASe'><form id='6GASe'><ins id='6GASe'></ins><ul id='6GASe'></ul><sub id='6GASe'></sub></form><legend id='6GASe'></legend><bdo id='6GASe'><pre id='6GASe'><center id='6GASe'></center></pre></bdo></b><th id='6GASe'></th></span></q></dt></tr></i><div id='6GASe'><tfoot id='6GASe'></tfoot><dl id='6GASe'><fieldset id='6GASe'></fieldset></dl></div>

        • <bdo id='6GASe'></bdo><ul id='6GASe'></ul>
      1. <legend id='6GASe'><style id='6GASe'><dir id='6GASe'><q id='6GASe'></q></dir></style></legend>

        什么是互操作 dll?

        What is the interop dll?(什么是互操作 dll?)

          <tbody id='txKjz'></tbody>
        • <i id='txKjz'><tr id='txKjz'><dt id='txKjz'><q id='txKjz'><span id='txKjz'><b id='txKjz'><form id='txKjz'><ins id='txKjz'></ins><ul id='txKjz'></ul><sub id='txKjz'></sub></form><legend id='txKjz'></legend><bdo id='txKjz'><pre id='txKjz'><center id='txKjz'></center></pre></bdo></b><th id='txKjz'></th></span></q></dt></tr></i><div id='txKjz'><tfoot id='txKjz'></tfoot><dl id='txKjz'><fieldset id='txKjz'></fieldset></dl></div>
              <tfoot id='txKjz'></tfoot>

            1. <small id='txKjz'></small><noframes id='txKjz'>

                <bdo id='txKjz'></bdo><ul id='txKjz'></ul>
                <legend id='txKjz'><style id='txKjz'><dir id='txKjz'><q id='txKjz'></q></dir></style></legend>
                  本文介绍了什么是互操作 dll?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我需要澄清一下.我有一个使用 Crystal Reports 的 Reportwriter dll.它是用VB6编写的.我必须将此 dll 添加到我的 asp.net 项目中,它会在其中创建一个互操作 dll.

                  I need some clarification. I have a Reportwriter dll that uses Crystal Reports. It is written in VB6. I have to add this dll to my asp.net project, where it creates an interop dll.

                  据我了解,interop dll 作为中介存在,因此我的 .net 代码可以与 Reportwriter dll 对话.

                  To my understanding, the interop dll is there as an intermediary so that my .net code can speak to the Reportwriter dll.

                  那么我是注册互操作 dll 还是注册原始 dll?

                  So do I register the interop dll or do I register the original dll?

                  推荐答案

                  在VB6中编写代码时,编译结果是一个COM组件.COM 组件提供接口、协同类、结构和枚举,这些通常使用 COM 类型库来描述.但是,要在 .NET 中使用该 COM 组件,您需要采用 .NET 可以理解的格式的类型描述 - 即 .NET 程序集(因为它不能直接与类型库一起使用).因此,互操作程序集只是一个转换后的"COM 类型库,从某种意义上说,它包含与类型库中相同事物相对应的接口、结构等的描述.

                  When you write code in VB6, the compiled result is a COM component. COM components provide interfaces, coclasses, structs and enums, which are normally described using a COM type library. However, to consume that COM component in .NET, you need type description in a format that .NET understands - that is, a .NET assembly (since it cannot work with type libraries directly). An interop assembly is therefore just a "converted" COM type library, in a sense that it contains descriptions of interfaces, structs etc that correspond to the same things in a type library.

                  (以上内容有所简化,因为互操作程序集必须从类型库生成 - 例如,如果需要,您可以手动编写代码.)

                  (The above is somewhat simplified, as interop assembly doesn't have to be produced from a type library - you can hand-code one if you want, for example.)

                  与常说的相反,互操作程序集不包含任何可执行代码,也不进行任何编组.它只包含类型定义,它唯一可以有方法的地方是在接口中,而接口中的方法没有实现.将 .NET 调用编组到 COM 调用实际上是由 CLR 本身根据从互操作程序集加载的类型描述完成的 - 它动态生成所有必要的代码.

                  Contrary to what is often said, an interop assembly doesn't contain any executable code, and it doesn't do any marshalling. It only contains type definitions, and the only place where it can have methods is in interfaces, and methods in interfaces don't have an implementation. Marshaling .NET calls to COM ones is actually done by CLR itself based on type descriptions loaded from interop assemblies - it generates all necessary code on the fly.

                  现在关于你的问题.您需要注册您的 COM DLL(VB6 的输出)项目 - 例如,使用 regsvr32.exe.您不应该(事实上,您不能)以这种方式注册互操作程序集,因为它不是 COM 组件 - 它只是一个普通的 .NET 程序集,因此您可以将它与您的 .exe/.dll 放在同一个文件夹中,或者像往常一样将其放入 GAC.

                  Now as to your question. You need to register your COM DLL (the output of your VB6) project - for example, using regsvr32.exe. You shouldn't (in fact, you cannot) register an interop assembly that way, because it's not a COM component - it's just a plain .NET assembly, so you can either put it in the same folder with your .exe/.dll, or put it into GAC, as usual.

                  这篇关于什么是互操作 dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Extract Display name and description Attribute from within a HTML helper(从 HTML 帮助器中提取显示名称和描述属性)
                  asp.net mvc Adding to the AUTHORIZE attribute(asp.net mvc 添加到 AUTHORIZE 属性)
                  Crystal Reports: Passing Multiline Parameter Values(Crystal Reports:传递多行参数值)
                  Bar code font error with crystal report on web server(Web 服务器上水晶报告的条形码字体错误)
                  displaying a crystal report using c#(使用 C# 显示水晶报表)
                  space between Crystal Reports Cross-Tab Column(Crystal Reports 交叉表列之间的空间)

                    <tbody id='Fe55J'></tbody>
                        <i id='Fe55J'><tr id='Fe55J'><dt id='Fe55J'><q id='Fe55J'><span id='Fe55J'><b id='Fe55J'><form id='Fe55J'><ins id='Fe55J'></ins><ul id='Fe55J'></ul><sub id='Fe55J'></sub></form><legend id='Fe55J'></legend><bdo id='Fe55J'><pre id='Fe55J'><center id='Fe55J'></center></pre></bdo></b><th id='Fe55J'></th></span></q></dt></tr></i><div id='Fe55J'><tfoot id='Fe55J'></tfoot><dl id='Fe55J'><fieldset id='Fe55J'></fieldset></dl></div>
                        <legend id='Fe55J'><style id='Fe55J'><dir id='Fe55J'><q id='Fe55J'></q></dir></style></legend>

                            <bdo id='Fe55J'></bdo><ul id='Fe55J'></ul>

                            <tfoot id='Fe55J'></tfoot>

                            <small id='Fe55J'></small><noframes id='Fe55J'>