Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using an x86 dll in a portable class library

End Goal

I have an x86 dll built in c++. I need to be able to use the dll from a portable class library. This can be directly or indirectly, but I want to keep the entire application local on the users computer.

What I have tried

I have designed a c++/cli wrapper to allow access to the dll. I confirmed it works through an x86 console C# project.

  • I tried using the wrapper directly from a portable class library but it would not allow the reference.
  • I tried using the wrapper from a wcf library but the library is having problems with the cross platform dll.

I think I'm making this way too complicated but I am unfamiliar with a way to do what I want. I can't rebuild the dll in 64-bit and do side by side loading - I only have the option of using the x86 dll.

Thank you for the help.

like image 901
user1433652 Avatar asked Jan 30 '26 21:01

user1433652


1 Answers

Why do you need to reference a C++ DLL from a Portable Class Library? A C++ DLL isn't going to be usable from multiple platforms. The point of PCLs is that they can run on more than one platform, but that means everything they reference needs to also be a PCL.

Probably what I'd recommend is to use the abstraction pattern, as described here.

like image 58
Daniel Plaisted Avatar answered Feb 01 '26 11:02

Daniel Plaisted



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!