Popularity
2.7
Growing
Activity
1.8
Growing
78
9
20

Programming language: C#
License: MIT License
Tags: Interoperability    
Latest version: v3.0.1.0

LegacyWrapper alternatives and similar packages

Based on the "Interoperability" category.
Alternatively, view LegacyWrapper alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of LegacyWrapper or a related project?

Add another 'Interoperability' Package

README

LegacyWrapper

About

LegacyWrapper uses a wrapper process to call dlls from a process of the opposing architecture (X86 or AMD64).

Since you can't load a dll of another architecture directly, the wrapper utilizes a named pipe to abstract the call. You won't notice this though, because all the magic is hidden behind a single static method.

NuGet Package

There is a NuGet package available here: Codefoundry.LegacyWrapper @ nuget.org

Usage

If you want to compile the LegacyWrapper yourself, make sure to place both the wrapper executable, LegacyWrapperClient.dll and LegacyWrapper.Common.dll in your directory.

// 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 configuration
IWrapperConfig 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);
}

Please note that loading a 64bit dll will only work on 64bit operating systems.

Further reading

View this blog post to obtain a basic understanding of how the library works internally.

Contributing

Feel free to submit any suggestions/issues and contribute to LegacyWrapper.

License

Copyright (c) 2019, Franz Wimmer. (MIT License)

See LICENSE for more info.


*Note that all licence references and agreements mentioned in the LegacyWrapper README section above are relevant to that project's source code only.