0

I have two .NET managed dlls that are platform dependent (x86/x64) for some reason. Both have the same public interfaces.

I need to reference them from AnyCPU project. But they cannot be simply loaded in runtime, since my code use interfaces those dlls expose.

Is it possible to create proxy dll that would represent an interface of those platform dependent libs compile time, and load dynamically in runtime platform specific dll for each platform and forward calls to it?

Seems like "Embedded Interop Types" feature looks similar to what I need, but its not a COM lib.

Is it feasible task or not? Please suggest anything may help.

1 Answers1

0

Well, you have already answered on your question using the best and recommended practice.

  1. Create AnyCPU assembly with common interface definitions.
  2. Reference this assembly in your app, and those two assemblies.
  3. Perform runtime loading depending on running architecture, instantiate and cast to the common interfaces
  4. profit

Please also look here for an advice how to choose right DLL in runtime

Community
  • 1
  • 1
PavPS
  • 76
  • 4