LegacyWrapper v3.0.0.0 Release Notes
Release Date: 2019-02-03 // almost 6 years ago-
LegacyWrapper 3.0 is a major rewrite and not backwards compatible to prior versions.
๐ See this blog post for details.
The old
Invoke<TDelegate>()
method has been replaced by a much simpler and more type-safe pattern:// Define a proxy interface with matching method names and signatures// The interface must be derived from IDisposable![LegacyDllImport("User32.dll")]public interface IUser32Dll : IDisposable{ [LegacyDllMethod(CallingConvention = CallingConvention.Winapi)] int GetSystemMetrics(int nIndex); }// Create configurationIWrapperConfig configuration = WrapperConfigBuilder.Create() .TargetArchitecture(TargetArchitecture.X86) .Build();// Create new Wrapper client providing the proxy interface// Remember to ensure a call to the Dispose()-Method!using (var client = WrapperProxyFactory<IUser32Dll>.GetInstance(configuration)) { // Make calls - it's that simple!int x = client.GetSystemMetrics(0); int y = client.GetSystemMetrics(1); }
Therefore, there is no longer the need to:
- Create a
delegate
- Cast result values
- Pass function parameters as array of
object
- Supply the method name as magic string
Other things that changed:
- ๐ Documentation on classes and methods has been improved
- โ There are more unit tests now (especially edge cases)