兼容不同版本dll
调用不同目录下不同版本的c++ dll
public static class ThirtyTwoBit
{
[DllImport("MedicalElectronics/32bit/NationECCode.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern IntPtr NationEcTrans(string strUrl, string InData, StringBuilder OutData);
}
public static class SixtyFourBit
{
[DllImport("MedicalElectronics/64bit/NationECCode.dll", CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
public static extern IntPtr NationEcTrans(string strUrl, string InData, StringBuilder OutData);
}
根据程序的版本自动调用对应版本的dll
调用方式:
if (Environment.Is64BitProcess)
{
data = SixtyFourBit.NationEcTrans(url, inData, stringBuilder);
}
else
{
data = ThirtyTwoBit.NationEcTrans(url, inData, stringBuilder);
}