Premise: I have two DLL's, one is 32 bits and 64 bits, they both have the same methods.
Problem: I can't use the 32 bits version everywhere.
[DllImport("Epsonx86.dll")]
private static extern int PrintLine(string line);
[DllImport("Epsonx64.dll")]
private static extern int PrintLine(string line);
...
Apparently, I can't use this:
string dllName = Environment.Is64BitOperatingSystem ? "Epsonx64.dll" : "Epsonx86.dll";
[DllImport(dllName)] //Error here.
...
So, How to make the code work with both without having to make lots of if's
?
Edit
I'm heading over Interface
implementation... Well, I got to work with an Interface
.
IEpson print;
if (Environment.Is64BitOperatingSystem)
{
print = new InterfaceEpsonNfx64();
}
else
{
print = new InterfaceEpsonNfx86();
}
print.PrintLine("BlaBla");