DDC.Miscellaneous.cs 734 B

123456789101112131415161718192021
  1. using System;
  2. using System.Runtime.InteropServices;
  3. using TDMS.Common;
  4. namespace TDMS.Externals
  5. {
  6. internal partial class DDC : DIAdemConnectivity
  7. {
  8. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_GetLibraryErrorDescription")]
  9. public static extern ref char GetLibraryErrorDescription(int errorCode);
  10. [DllImport(DLL, CallingConvention = CallingConvention.StdCall, EntryPoint = "DDC_FreeMemory")]
  11. public static extern void FreeMemory(IntPtr memoryPointer);
  12. public static string GetErrorDescription(int errorCode)
  13. {
  14. var ptr = GetLibraryErrorDescription(errorCode);
  15. return Marshal.PtrToStringAnsi(ptr);
  16. }
  17. }
  18. }