'On Linus, the deprecated Toupcam_Snap method of the libtoupcam.so library

Good afternoon. The program uses the P/Invoke approach:

[DllImport(dll, ExactSpelling = true, CallingConvention = cc)]
private static extern int Toupcam_Snap(SafeCamHandle h, uint nResolutionIndex);

where dll - libtoupcam.so

and the SafeCamHandle class has the following structure:

#if !(NETFX_CORE || WINDOWS_UWP)
    public class SafeCamHandle : SafeHandleZeroOrMinusOneIsInvalid
    {
        [DllImport(dll, ExactSpelling = true, CallingConvention = cc)]
        private static extern void Toupcam_Close(IntPtr h);

        public SafeCamHandle()
            : base(true)
        {
        }

        override protected bool ReleaseHandle()
        {
            // Here, we must obey all rules for constrained execution regions.
            Toupcam_Close(handle);
            return true;
        }
    };#else

Method call:

Toupcam_Snap(_handle, nResolutionIndex)

is very fast (1 second) on Windows OS, but a few minutes on AtraLinux OS.

Questions:

  1. With what it can be connected;
  2. In which direction should I dig, because I have no experience in P/Invoke


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source