问题
I want to import some functions from kernel32.dll, but I want to use different names. Example function:
[DllImport("kernel32.dll")] private static extern bool ReadProcessMemoryProc64 (...);
private static bool BetterReadableAndWriteableName (...) {
ReadProcessMemoryProc64(...);
}
Wrapping the function is what I actually don't want, if there is another way.
回答1:
Use the EntryPoint property of DllImportAttribute.
[DllImport("kernel32.dll", EntryPoint="ReadProcessMemoryProc64")]
private static extern bool BetterReadableAndWriteableName (...);
回答2:
[DllImport("kernel32.dll", EntryPoint = "ReadProcessMemoryProc64")]
private static extern bool MyName(...);
来源:https://stackoverflow.com/questions/21005017/alias-for-function