Tlbimp New Version released:/V2 &/preservesig

Source: Internet
Author: User

Two weeks ago, the CLR InterOP team released a new version of tlbimp. I should have written a blog to introduce it, but I have been busy with the development of new CLR InterOP functions and it is difficult to spare time. Two minor functions are added in this version:

1./V2 Switch

In the new tlbimp version, we cannot change the behavior of the new version at will, to avoid program compilation errors or incorrect Behaviors Caused by compatibility issues when users adopt the new version. This switch is used to tell tlbimp to adopt the new version and ignore compatibility requirements. Currently, the/V2 switch has only one function (more will be added in the future): Convert variant_bool in struct/Union to bool, instead of short in the previous version, which makes it easier for users to use. In fact, many users require this change. The previous version of tlbimp converts variant_bool to short because the old version of InterOP externaler (should be. Net V1.0) does not support this conversion. After that, although marshaler supports this behavior, we have never had the opportunity to modify tlbimp. The release of tlbimp in codeplex gave us a great opportunity to modify tlbimp to support the functions we always wanted but didn't do, and we don't have to wait for the next version.

2./preservesig Switch

This feature is also required by many users. Once opened, all methods in the interface/class will be labeled with the preservesigattribute attribute, and the prototype of the function will be changed accordingly. At the same time, the returned hresult will not be converted to the corresponding one.. Net exception. In many cases, when calling COM, it is expected that the call fails and corresponding processing is performed, and the failure is very common. In this case, converting hresult to exception is completely unnecessary performance loss. If this switch is enabled, the CLR does not automatically convert the hresult into an exception. Instead, the user needs to check the returned hresult and use a method similar to the failed and succeeded macros. It is not convenient to throw an exception before use, but it provides more flexibility to avoid unnecessary performance overhead.

If you are interested, you can find the latest version here:

Http://www.codeplex.com/clrinterop/Release/ProjectReleases.aspx? Releaseid = 17579

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.