I try to develope an C# Interface for using an USB Hardware Device. I access the API DLL Via PInvoke pattern from the manufacturer. There are two DLLs with the same name. But one is for 32Bit Systems and the other one for 64Bit Systems. I want that my application uses the right API for each system.
So i start checking wich platfrom is in use:
bool is64Bit = System.Environment.Is64BitOperatingSystem
I defined a string variable and set the name of recommend .DLL.
like this:
string dll;
if (is64bit)
{
dll = "APINAME64.DLL";
}
else
{
dll = "APINAME32.DLL"
}
[DllImport(dll, SetLastError=true)]
public static extern bool ImmConfigureIME();
But this is still not working. The Compiler wants an const string for Pinvoke.
Does anybody has an idea how to solve that?