NET:LavishVMAPI.LavishVM.GetAPI
Jump to navigation
Jump to search
Contents
Overview
For use with bootstrapped API, retrieves the function pointer to an API function. The function pointer may then be marshaled into a delegate instance.
Reference Library
Fully Qualified Name
- LavishVMAPI.LavishVM.GetAPI
- LavishVMAPI namespace
- LavishVM class
- GetAPI function
- LavishVM class
Declaration
static public IntPtr GetAPI(string Library, string Name, uint Version);
Parameters
- string Library
- Name of the registered library containing the API function
- string Name
- Name of the API function
- uint Version
- Version number of the API function
Return Value
- IntPtr
- Function pointer to the retrieved API, or int value 0 if the API could not be retrieved
Examples
C#
- This is the stub used for InnerSpace.Echo, which retrieves the API and calls through if the function is available, additionally replacing the delegate that points to the stub such that additional calls will go straight to the API.
static public void Echo(string Output) { IntPtr Address = LavishVM.GetAPI("Inner Space", "Echo", 1); if (Address.ToInt32() == 0) { Console.WriteLine(Output); return; } InnerSpace.Echo = (InnerSpaceAPI.Delegates.Echo)Marshal.GetDelegateForFunctionPointer(Address, typeof(InnerSpaceAPI.Delegates.Echo)); InnerSpace.Echo(Output); }