From b377adcc67c1241cceda6a227290d84379a8b3b9 Mon Sep 17 00:00:00 2001 From: Sergey Shulyak Date: Sun, 27 Dec 2020 13:47:06 +0300 Subject: [PATCH] using SafeHandle in Context class --- wrappers/csharp/Intel.RealSense/Context.cs | 66 ++++++++++--- .../csharp/Intel.RealSense/NativeMethods.cs | 94 +++++++++++-------- 2 files changed, 110 insertions(+), 50 deletions(-) diff --git a/wrappers/csharp/Intel.RealSense/Context.cs b/wrappers/csharp/Intel.RealSense/Context.cs index 8484913f5b..9bd377da8f 100644 --- a/wrappers/csharp/Intel.RealSense/Context.cs +++ b/wrappers/csharp/Intel.RealSense/Context.cs @@ -5,12 +5,37 @@ namespace Intel.RealSense { using System; using System.Runtime.InteropServices; + using Microsoft.Win32.SafeHandles; + using System.Runtime.ConstrainedExecution; + using System.Security.Permissions; + + + [SecurityPermission(SecurityAction.LinkDemand, UnmanagedCode = true)] + public sealed class ContextHandle : SafeHandleZeroOrMinusOneIsInvalid + { + public ContextHandle() + : base(true) + { + } + + [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)] + override protected bool ReleaseHandle() + { + if (!IsClosed) + { + NativeMethods.rs2_delete_context(this); + } + return true; + } + } /// /// default librealsense context class /// - public class Context : Base.Object + public class Context : IDisposable { + private ContextHandle handle; + static Context() { object error; @@ -21,11 +46,29 @@ static Context() /// Initializes a new instance of the class. /// public Context() - : base(Create(), NativeMethods.rs2_delete_context) { + object error; + handle = NativeMethods.rs2_create_context(ApiVersion, out error); onDevicesChangedCallback = new rs2_devices_changed_callback(OnDevicesChangedInternal); } + /// + /// Gets the safe handle + /// + /// Thrown when + public ContextHandle Handle + { + get + { + if (handle.IsInvalid) + { + throw new ObjectDisposedException(GetType().Name); + } + + return handle; + } + } + /// /// the version API encoded into integer value "1.9.3" -> 10903 /// @@ -47,12 +90,6 @@ public string Version } } - internal static IntPtr Create() - { - object error; - return NativeMethods.rs2_create_context(ApiVersion, out error); - } - // Keeps the delegate alive, if we were to assign onDevicesChanged directly, there'll be // no managed reference it, it will be collected and cause a native exception. private readonly rs2_devices_changed_callback onDevicesChangedCallback; @@ -80,7 +117,7 @@ public event OnDevicesChangedDelegate OnDevicesChanged if (OnDevicesChangedEvent == null) { object error; - NativeMethods.rs2_set_devices_changed_callback(Handle, onDevicesChangedCallback, IntPtr.Zero, out error); + NativeMethods.rs2_set_devices_changed_callback(handle, onDevicesChangedCallback, IntPtr.Zero, out error); } OnDevicesChangedEvent += value; @@ -105,7 +142,7 @@ public event OnDevicesChangedDelegate OnDevicesChanged public DeviceList QueryDevices(bool include_platform_camera = false) { object error; - var ptr = NativeMethods.rs2_query_devices_ex(Handle, include_platform_camera ? 0xff : 0xfe, out error); + var ptr = NativeMethods.rs2_query_devices_ex(handle, include_platform_camera ? 0xff : 0xfe, out error); return new DeviceList(ptr); } @@ -127,7 +164,7 @@ public DeviceList Devices public PlaybackDevice AddDevice(string file) { object error; - var ptr = NativeMethods.rs2_context_add_device(Handle, file, out error); + var ptr = NativeMethods.rs2_context_add_device(handle, file, out error); return Device.Create(ptr); } @@ -136,7 +173,7 @@ public PlaybackDevice AddDevice(string file) public void RemoveDevice(string file) { object error; - NativeMethods.rs2_context_remove_device(Handle, file, out error); + NativeMethods.rs2_context_remove_device(handle, file, out error); } private void OnDevicesChangedInternal(IntPtr removedList, IntPtr addedList, IntPtr userData) @@ -151,5 +188,10 @@ private void OnDevicesChangedInternal(IntPtr removedList, IntPtr addedList, IntP } } } + + public void Dispose() + { + handle.Dispose(); + } } } diff --git a/wrappers/csharp/Intel.RealSense/NativeMethods.cs b/wrappers/csharp/Intel.RealSense/NativeMethods.cs index e2805a95af..c945da249d 100644 --- a/wrappers/csharp/Intel.RealSense/NativeMethods.cs +++ b/wrappers/csharp/Intel.RealSense/NativeMethods.cs @@ -53,7 +53,7 @@ internal static MemCpyDelegate GetMethod() [DllImport("msvcrt.dll", EntryPoint = "memcpy", CallingConvention = CallingConvention.Cdecl, SetLastError = false)] internal static extern IntPtr win_memcpy(IntPtr dest, IntPtr src, int count); -#region rs_record_playback + #region rs_record_playback [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_create_record_device(IntPtr device, [MarshalAs(UnmanagedType.LPStr)] string file, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -104,9 +104,8 @@ internal static MemCpyDelegate GetMethod() [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern void rs2_playback_device_stop(IntPtr device, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); - -#endregion -#region rs_processing + #endregion + #region rs_processing [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_create_colorizer([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -193,7 +192,6 @@ internal static MemCpyDelegate GetMethod() [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_create_sequence_id_filter([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); - #endregion #region rs_option [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] @@ -228,9 +226,8 @@ internal static MemCpyDelegate GetMethod() [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_get_option_value_description(IntPtr options, Option option, float value, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); - -#endregion -#region rs_frame + #endregion + #region rs_frame [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern long rs2_get_frame_metadata(IntPtr frame, FrameMetadataValue frame_metadata, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -301,10 +298,10 @@ internal static MemCpyDelegate GetMethod() internal static extern IntPtr rs2_allocate_synthetic_motion_frame(IntPtr source, IntPtr new_stream, IntPtr original, Extension frame_type, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] - internal static extern IntPtr rs2_allocate_composite_frame(IntPtr source, [In]IntPtr[] frames, int count, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + internal static extern IntPtr rs2_allocate_composite_frame(IntPtr source, [In] IntPtr[] frames, int count, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] - internal static extern IntPtr rs2_allocate_composite_frame(IntPtr source, [In]IntPtr frames, int count, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + internal static extern IntPtr rs2_allocate_composite_frame(IntPtr source, [In] IntPtr frames, int count, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_extract_frame(IntPtr composite, int index, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -317,9 +314,8 @@ internal static MemCpyDelegate GetMethod() [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern void rs2_pose_frame_get_pose_data(IntPtr frame, [In, Out] Pose pose, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); - -#endregion -#region rs_sensor + #endregion + #region rs_sensor [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern void rs2_delete_sensor_list(IntPtr info_list); @@ -357,7 +353,7 @@ internal static MemCpyDelegate GetMethod() internal static extern void rs2_open(IntPtr device, IntPtr profile, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] - internal static extern void rs2_open_multiple(IntPtr device, [In]IntPtr[] profiles, int count, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + internal static extern void rs2_open_multiple(IntPtr device, [In] IntPtr[] profiles, int count, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern void rs2_close(IntPtr sensor, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -473,8 +469,10 @@ internal static MemCpyDelegate GetMethod() [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern void rs2_get_motion_intrinsics(IntPtr profile, out MotionDeviceIntrinsics intrinsics, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); -#endregion -#region rs_device + [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] + internal static extern float rs2_get_max_usable_depth_range(IntPtr sensor, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + #endregion + #region rs_device [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern int rs2_get_device_count(IntPtr info_list, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -516,26 +514,25 @@ internal static MemCpyDelegate GetMethod() [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_create_flash_backup(IntPtr device, rs2_update_progress_callback callback, IntPtr user_data, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); - #endregion #region rs_context [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] - internal static extern IntPtr rs2_create_context(int api_version, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + internal static extern ContextHandle rs2_create_context(int api_version, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] - internal static extern void rs2_delete_context(IntPtr context); + internal static extern void rs2_delete_context(ContextHandle context); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] - internal static extern IntPtr rs2_context_add_device(IntPtr ctx, [MarshalAs(UnmanagedType.LPStr)] string file, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + internal static extern IntPtr rs2_context_add_device(ContextHandle ctx, [MarshalAs(UnmanagedType.LPStr)] string file, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] - internal static extern void rs2_context_remove_device(IntPtr ctx, [MarshalAs(UnmanagedType.LPStr)] string file, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + internal static extern void rs2_context_remove_device(ContextHandle ctx, [MarshalAs(UnmanagedType.LPStr)] string file, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_query_devices(IntPtr context, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] - internal static extern IntPtr rs2_query_devices_ex(IntPtr context, int mask, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + internal static extern IntPtr rs2_query_devices_ex(ContextHandle context, int mask, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_create_device_hub(IntPtr context, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -550,12 +547,12 @@ internal static MemCpyDelegate GetMethod() internal static extern int rs2_device_hub_is_device_connected(IntPtr hub, IntPtr device, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] - internal static extern void rs2_set_devices_changed_callback(IntPtr ctx, rs2_devices_changed_callback callback, IntPtr user_data, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + internal static extern void rs2_set_devices_changed_callback(ContextHandle ctx, rs2_devices_changed_callback callback, IntPtr user_data, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] - internal static extern void rs2_context_add_software_device(IntPtr ctx, IntPtr device, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); -#endregion -#region rs + internal static extern void rs2_context_add_software_device(ContextHandle ctx, IntPtr device, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + #endregion + #region rs [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern int rs2_get_raw_data_size(IntPtr buffer, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -588,9 +585,8 @@ internal static MemCpyDelegate GetMethod() [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern double rs2_get_time([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); - -#endregion -#region rs_advanced_mode + #endregion + #region rs_advanced_mode [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern void rs2_toggle_advanced_mode(IntPtr dev, int enable, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -680,9 +676,28 @@ internal static MemCpyDelegate GetMethod() [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_serialize_json(IntPtr dev, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + #endregion + #region rs_calibrated_device + [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] + internal static extern void rs2_write_calibration(IntPtr dev, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + + [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] + internal static extern void rs2_reset_to_factory_calibration(IntPtr dev, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + #endregion + #region rs_auto_calibrated_device + [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] + internal static extern IntPtr rs2_run_on_chip_calibration(IntPtr dev, [MarshalAs(UnmanagedType.LPStr)] string json_content, int content_size, out float health, [MarshalAs(UnmanagedType.FunctionPtr)] rs2_update_progress_callback callback, IntPtr client_data, int timeout_ms, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); -#endregion -#region rs_internal + [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] + internal static extern IntPtr rs2_run_tare_calibration(IntPtr dev, float ground_truth_mm, [MarshalAs(UnmanagedType.LPStr)] string json_content, int content_size, [MarshalAs(UnmanagedType.FunctionPtr)] rs2_update_progress_callback callback, IntPtr client_data, int timeout_ms, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + + [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] + internal static extern IntPtr rs2_get_calibration_table(IntPtr dev, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + + [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] + internal static extern void rs2_set_calibration_table(IntPtr dev, IntPtr calibration, int content_size, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + #endregion + #region rs_internal [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_create_recording_context(int api_version, [MarshalAs(UnmanagedType.LPStr)] string filename, [MarshalAs(UnmanagedType.LPStr)] string section, RecordingMode mode, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -727,13 +742,15 @@ internal static MemCpyDelegate GetMethod() internal static extern void rs2_software_sensor_update_read_only_option(IntPtr sensor, Option option, float val, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); #endregion #region fw_logs - [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_create_fw_log_message(IntPtr device, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern void rs2_delete_fw_log_message(IntPtr fw_log); + [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] + internal static extern uint rs2_get_number_of_fw_logs(IntPtr device, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern int rs2_get_fw_log(IntPtr device, IntPtr fw_log_, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -781,6 +798,9 @@ internal static MemCpyDelegate GetMethod() [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern uint rs2_get_fw_log_parsed_timestamp(IntPtr fw_parsed_log, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + + [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] + internal static extern uint rs2_get_fw_log_parsed_sequence_id(IntPtr fw_parsed_log, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); #endregion #region terminal_parser [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] @@ -797,12 +817,11 @@ internal static extern IntPtr rs2_terminal_parse_command(IntPtr terminal_parser, internal static extern IntPtr rs2_terminal_parse_response(IntPtr terminal_parser, [MarshalAs(UnmanagedType.LPStr)] string command, uint size_of_command, IntPtr response_bytes, uint size_of_response, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); - #endregion #endregion #region rs_pipeline [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] - internal static extern IntPtr rs2_create_pipeline(IntPtr ctx, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + internal static extern IntPtr rs2_create_pipeline(ContextHandle ctx, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern void rs2_pipeline_stop(IntPtr pipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); @@ -881,10 +900,9 @@ internal static extern IntPtr rs2_terminal_parse_response(IntPtr terminal_parser [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern int rs2_config_can_resolve(IntPtr config, IntPtr pipe, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(ErrorMarshaler))] out object error); + #endregion -#endregion - -#region Error Handling + #region Error Handling [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_get_failed_function(IntPtr error); @@ -899,7 +917,7 @@ internal static extern IntPtr rs2_terminal_parse_response(IntPtr terminal_parser [DllImport(dllName, CallingConvention = CallingConvention.Cdecl)] internal static extern IntPtr rs2_free_error(IntPtr error); -#endregion + #endregion } }