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.
alias is a simple wrapper for the function builtin, which creates a function wrapping a command. It has similar syntax to POSIX shell alias . For other uses, it is recommended to define a function.
To create an alias, we need to create a file called bash_profile or bashrc. This file needs to be in the root directory and should be hidden to avoid mishandling of its contents. Inside of this file, we create an alias which is basically a map of commands and the sets of commands/functions to be executed as a shortcut.
In contrast to a normal Python method, an alias method accesses an original method via a different name—mostly for programming convenience. An example is the iterable method __next__() that can also be accessed with next() . You can define your own alias method by adding the statement a = b to your class definition.
Functions can be used in scripts or in the console, but are more often used in scripts. Contrary to aliases, which are just replaced by their value, a function will be interpreted by the bash shell. Functions are much more powerful than aliases. They can be used to build very complex programs.
Use the EntryPoint property of DllImportAttribute.
[DllImport("kernel32.dll", EntryPoint="ReadProcessMemoryProc64")]
private static extern bool BetterReadableAndWriteableName (...);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With