1、 clrinsideout2008_01.exe Program
2. Merge the declarations of all C functions, structures, and constants into one file.
3. Remove all pre-compiled commands and header file import declarations.
4. Remove macros defined as functions
5. Use the above program to convert it, check the first error carefully, and correct it.
6. Copy it to the C # class library and sort it out.
7. Specify the dll name for Function Import.
8. Add call conventions for Functions
9. Add a call convention for the delegate
Form: [UnmagedFunctionPointer (CallingConvention. Cdecl)]
10. search with the keyword "Error" to solve the problem.
11. Platform calls are function-centric and can be deleted from useless structures, delegates, constants, and enumerations.
12. Repeat it carefully to find unreasonable places.
13. char * is changed to StringBuilder rather than IntPtr;
Change BOOL to bool instead of int, and add [return: financialas (UnmanagedType. Bool)];
Unsigned char * changes IntPtr instead of string.
14. Rename Anonymous members
15. The structure is too complex or too large.
Void F (ref ){}
Declaration changed:
Void F (IntPtr ){}
If the pointer only obtains data:
Var intPtr = Marshal. allocHGlobal (Marshal. sizeOf (typeof (A); F (intPtr); var w = (A) Marshal. ptrToStructure (intPtr, typeof ());
If the pointer only sends data:
Var intPtr = Marshal. AllocHGlobal (Marshal. SizeOf (typeof (A); A aa; Marshal. StructureToPtr (aa, intPtr, true); F (intPtr );