Alias for function

不想你离开。 提交于 2020-01-14 07:55:28

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!