private static extern int _yapiGetDeviceInfo(YDEV_DESCR d, ref yDeviceSt infos, StringBuilder errmsg);
/* not used protected static int yapiGetAllDevices(IntPtr dbuffer, int maxsize, ref int neededsize, ref string errmsg) { int functionReturnValue = 0; StringBuilder buffer = new StringBuilder(YOCTO_ERRMSG_LEN); buffer.Length = 0; functionReturnValue = _yapiGetAllDevices(dbuffer, maxsize, ref neededsize, buffer); errmsg = buffer.ToString(); return functionReturnValue; } */ protected static int yapiGetDeviceInfo(YDEV_DESCR d, ref yDeviceSt infos, ref string errmsg) { int functionReturnValue = 0; StringBuilder buffer = new StringBuilder(YOCTO_ERRMSG_LEN); buffer.Length = 0; functionReturnValue = _yapiGetDeviceInfo(d, ref infos, buffer); errmsg = buffer.ToString(); return functionReturnValue; }
private static extern void DllCallTest(ref yDeviceSt data);
private static int _yapiGetDeviceInfo(YDEV_DESCR d, ref yDeviceSt infos, StringBuilder errmsg) { if (IntPtr.Size == 4) { return _yapiGetDeviceInfo32(d, ref infos, errmsg); } else { try { return _yapiGetDeviceInfo64(d, ref infos, errmsg); } catch (System.DllNotFoundException) { return _yapiGetDeviceInfo32(d, ref infos, errmsg); } } }