如何使用C#中的MS DIA SDK? [英] How do I use the MS DIA SDK from C#?

查看:144
本文介绍了如何使用C#中的MS DIA SDK?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用Microsoft 调试接口访问SDK 从C#。这是与Visual Studio一起安装的,但是文档似乎没有提到你如何使用C#。



我已经在Interweb上找到了示例代码,但没有关于如何链接到DIA SDK。即我无法将其导入为程序集。我不认为我必须将它包含在一个托管的C ++应用程序中,并将其用作COM(这将是地狱)。



有一个IDL文件,这是正确的方法?如果是这样,怎么办?






编辑:以下将创建用作引用程序集的类型库。粘贴到批处理文件。

 调用%VS80COMNTOOLS%\vsvars32.bat
midl / I% VSINSTALLDIR%\DIA SDK\include%VSINSTALLDIR%\DIA SDK\idl\dia2.idl/ tlb dia2.tlb
tlbimp dia2.tlb


解决方案

您需要先将IDL转换为typelib:



如下:

  midl / I%VSINSTALLDIR%\DIA SDK\includedia2.idl / tlb dia2.tlb 
tlbimp dia2.tlb

然后你可以导入tlb。 / p>

我从来没有使用DIA SDK,所以不知道它会是多么友好。您还可以考虑直接从托管的C ++程序集中使用它,并将管理的界面显示给所需的功能。


I'm trying to use the Microsoft Debug Interface Access SDK from C#. This is installed with Visual Studio, but the docs don't seem to mention how you use this from C#.

I've found example code on interweb but no information on how to link to the DIA SDK. I.e. I can't import it as an assembly. I don't think I have to include it into a managed C++ application and use it as COM (that would be hell).

There is an IDL file, is this the correct way? If so, how?


Edit: The following will create the type library for use as a referenced assembly. Paste into a batch file.

call "%VS80COMNTOOLS%\vsvars32.bat"
midl /I "%VSINSTALLDIR%\DIA SDK\include" "%VSINSTALLDIR%\DIA SDK\idl\dia2.idl" /tlb dia2.tlb
tlbimp dia2.tlb

解决方案

You need to convert the IDL to a typelib first:

Something like:

midl /I "%VSINSTALLDIR%\DIA SDK\include" dia2.idl /tlb dia2.tlb
tlbimp dia2.tlb

Then you can import the tlb.

I've never used the DIA SDK this way, so don't know how friendly it would be. You could also consider using it directly from a managed C++ assembly and presenting a managed interface to the functionality you need.

这篇关于如何使用C#中的MS DIA SDK?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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