Windows core programming Chapter 2-string

Source: Internet
Author: User

I read the string again today and summarize it as follows:

The example in the book is written in the DLL, so I learned how to write the DLL in a simple sense.

1: The def file will prevent the exported function name from being tampered with, because the C ++ compiler may add some suffixes to the function for polymorphism.

Def file is simple

Library "win32dll"

Exports
Sfstringreversew @ 1

2: select the Win32 project in vs2005, and select DLL or EXE after OK. The dll will write the dllmain function by itself.

3: defined in the DLL header file

# Ifdef Unicode
# Define stringreverse sfstringreversew
# Else
# Define stringreverse sfstringreversea
# Endif

This is to provide the header file to the user.

) I learned how to apply for a heap and convert the string (Unicode to ANSI and ANSI to Unicode); widechartomultibyte and multibytetowidechar.

 

Tomorrow I will ask: why is it possible that the malloc function is not used directly in the DLL because it is not necessarily called by C? If Delphi is called, the problem may occur?

 

 

 

2010-08-19

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.