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

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

问题描述

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

我发现在interweb例如code,但对如何链接到DIA SDK的信息。即我不能导入它作为一个组件。我不认为我已经把它列入到托管C ++应用程序,并把它作为COM(这将是地狱)。

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


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

 所说的%VS80COMNTOOLS%\ vsvars32.bat
MIDL / I%VSINSTALLDIR%\ DIA SDK \包括%VSINSTALLDIR%\ DIA SDK \ IDL \ dia2.idl/ TLB dia2.tlb
TLBIMP dia2.tlb
 

解决方案

您需要将IDL转换为一个类型库第一:

是这样的:

  MIDL / I%VSINSTALLDIR%\ DIA SDK \包括dia2.idl / TLB dia2.tlb
TLBIMP dia2.tlb
 

然后就可以导入TLB。

我从来没有使用DIA SDK这种方式,所以不知道这将是多么的友好是。你也可以考虑直接使用它从一个托管C ++组件和presenting一个管理界面,你所需要的功能。

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.

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

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