C ++ converts data type to C #

Source: Internet
Author: User

Many projects involve C # Calling C ++ DLL.

This work can be divided into two aspects:

(1) rewrite the types defined in C ++ in C #, mainly struct and # define.

(2) introduce the DLL of C ++ in C # And use [dllimport ("*. dll")] public static extern long API.

 

In both aspects, you need to understand the data type corresponding to C ++ to C #.ArticleFor more information about calling the C # DLL method, see other articles.

C ++ C #

INT (long) int32

Byte byte

Word (unsigned short) uint16

DWORD (unsigned INT) uint32

Char char

Handle (void *) intptr

Bool Boolean

Unsigned long * (DWORD *) ulong []

Unsigned char * byte []

Char * string

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.