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