再论Type Library Importer (Tlbimp.exe)

The Type Library Importer converts the type definitions found within a COM type library into equivalent definitions in a common language runtime assembly. The output of Tlbimp.exe is a binary file (an assembly) that contains runtime metadata for the types defined within the original type library. You can examine this file with tools such as Ildasm.exe.

tlbimp tlbFile [options]

Argument

Description

tlbFile

The name of any file that contains a COM type library.

 Examples

The following command generates an assembly with the same name as the type library found in myTest.tlb and with the .dll extension.

tlbimp myTest.tlb 

The following command generates an assembly with the name myTest.dll.

tlbimp  myTest.tlb  /out:myTest.dll

The following command generates an assembly with the same name as the type library specified by MyModule.dll\1 and with the .dll extension. MyModule.dll\1 must be located in the current directory.

tlbimp MyModule.dll\1

The following command generates an assembly with the name myTestLib.dll for the type library TestLib.dll. The /transform:dispret option transforms any [out, retval] parameters of methods on dispinterfaces in the type library into return values in the managed library.

tlbimp TestLib.dll /transform:dispret /out:myTestLib.dll

The type library TestLib.dll, in the preceding example, includes a dispinterface method named SomeMethod that returns void and has an [out, retval] parameter. The following code is the input type library method signature for SomeMethod in TestLib.dll.

void SomeMethod([out, retval] VARIANT_BOOL*);

Specifying the /transform:dispret option causes Tlbimp.exe to transform the [out, retval] parameter of SomeMethod into a bool return value. The following is the method signature that Tlbimp.exe produces for SomeMethod in the managed library myTestLib.dll when the /transform:dispret option is specified.

C#
 
bool SomeMethod();

If you use Tlbimp.exe to produce a managed library for TestLib.dll without specifying the /transform:dispret, the tool produces the following method signature for SomeMethod in the managed library myTestLib.dll.

 

void SomeMethod(out bool x);

转载于:https://www.cnblogs.com/MayGarden/archive/2010/04/18/1714638.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值