[MediaVision] Change string marshal logic (#4610)
authorHaesu Gwon <haesu.gwon@samsung.com>
Thu, 29 Sep 2022 07:21:46 +0000 (16:21 +0900)
committerGitHub <noreply@github.com>
Thu, 29 Sep 2022 07:21:46 +0000 (16:21 +0900)
src/Tizen.Multimedia.Vision/Interop/Interop.MediaVision.Face.cs
src/Tizen.Multimedia.Vision/MediaVision/DeepLearningFaceRecognizer.cs

index dd013a1..5babae1 100755 (executable)
@@ -174,7 +174,7 @@ internal static partial class Interop
             internal static extern MediaVisionError Inference(IntPtr handle, IntPtr source);
 
             [DllImport(Libraries.MediaVisionFaceRecognition, EntryPoint = "mv_face_recognition_get_label")]
-            internal static extern MediaVisionError GetLabel(IntPtr handle, out string label);
+            internal static extern MediaVisionError GetLabel(IntPtr handle, out IntPtr label);
         }
     }
 }
index ab922c8..2ee8b0e 100755 (executable)
@@ -15,6 +15,7 @@
  */
 
 using System;
+using System.Runtime.InteropServices;
 using InteropFace = Interop.MediaVision.FaceRecognition;
 
 namespace Tizen.Multimedia.Vision
@@ -138,9 +139,9 @@ namespace Tizen.Multimedia.Vision
                 ret.Validate("failed to recognize face");
             }
 
-            InteropFace.GetLabel(_handle, out string label).Validate("Failed to get label");
+            InteropFace.GetLabel(_handle, out IntPtr label).Validate("Failed to get label");
 
-            return new DeepLearningFaceRecognitionResult(label);
+            return new DeepLearningFaceRecognitionResult(Marshal.PtrToStringAnsi(label));
         }
 
         /// <summary>