我想从kernel32.dll导入一些函数,但我想使用不同的名称。示例功能:
[DllImport("kernel32.dll")] private static extern bool ReadProcessMemoryProc64 (...);
private static bool BetterReadableAndWriteableName (...) {
ReadProcessMemoryProc64(...);
}
如果还有其他方式,包装该功能是我实际上不想要的。
答案 0 :(得分:13)
使用DllImportAttribute的EntryPoint属性。
[DllImport("kernel32.dll", EntryPoint="ReadProcessMemoryProc64")]
private static extern bool BetterReadableAndWriteableName (...);
答案 1 :(得分:4)
[DllImport("kernel32.dll", EntryPoint = "ReadProcessMemoryProc64")]
private static extern bool MyName(...);