{"id":8962,"date":"2017-11-21T11:00:07","date_gmt":"2017-11-21T02:00:07","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/?p=8962"},"modified":"2017-11-21T11:03:16","modified_gmt":"2017-11-21T02:03:16","slug":"swig-%e3%81%ae%e6%96%87%e5%ad%97%e5%88%97%ef%bc%88string%ef%bc%89%e3%81%ae%e6%89%b1%e3%81%84%e3%81%8c%e5%b0%91%e3%81%97%e3%82%84%e3%82%84%e3%81%93%e3%81%97%e3%81%84%e3%81%ae%e3%81%a7%e3%80%81marshal","status":"publish","type":"post","link":"https:\/\/www.moonmile.net\/blog\/archives\/8962","title":{"rendered":"SWIG \u306e\u6587\u5b57\u5217\uff08string\uff09\u306e\u6271\u3044\u304c\u5c11\u3057\u3084\u3084\u3053\u3057\u3044\u306e\u3067\u3001Marshal.* \u3092\u4f7f\u3063\u3066\u307f\u308b\u30c6\u30b9\u30c8"},"content":{"rendered":"<p>\n\u5185\u90e8\u30b3\u30fc\u30c9\u3092 std::string\/char * \u306b\u3059\u308b\u304b std::wstring\/wchar_t * \u306b\u3059\u308b\u304b\u3067\u3001SWIG \u306e\u6319\u52d5\u304c\u5909\u308f\u308b\u3088\u3046\u306a\u611f\u3058\u306a\u306e\u3067\u3001\u305d\u306e\u524d\u6bb5\u968e\u306e\u30c6\u30b9\u30c8\n<\/p>\n<p><h2>\u623b\u308a\u5024\u3092string\u578b\u306b\u3059\u308b SWIG \u306e\u6280<\/h2>\n<\/p>\n<p>\nC#\u5074\u304b\u3089\u307f\u308c\u3070C++\u306eDLL\u304b\u3089\u6587\u5b57\u5217\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u3001GetName( const char *, int ) \u3068\u3057\u3066\u30d0\u30c3\u30d5\u30a1\u3092\u6e21\u3059\u3088\u308a\u3082\u3001string GetName() \u306a\u5f62\u3067\u3001string \u578b\u3092\u8fd4\u3057\u3066\u6b32\u3057\u3044\u308f\u3051\u3067\u3059\u3002\u305d\u3046\u306a\u308b\u3068\u3001dllimport \u306e\u90e8\u5206\u3082\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;GetNameStr&quot;)]\r\n static extern string GetNameStr();\r\n<\/pre>\n<p>\n\u306a\u5f62\u306b\u3057\u3066\u304a\u304d\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3088\u306d\u3002\u3057\u304b\u3057\u3001\u3053\u308c\u306f\u3067\u304d\u307e\u305b\u3093\u3002\u623b\u308a\u5024\u306f string \u306b\u81ea\u52d5\u5909\u63db\u3057\u3066\u304f\u308c\u306a\u3044\u3093\u3067\u3059\u306d\u3002\n<\/p>\n<p>\n\u4e0d\u601d\u8b70\u306a\u3053\u3068\u306b\u3001SWIG \u306e\u5834\u5408\u306f\u623b\u308a\u5024\u306b string \u3092\u4f7f\u3048\u3066\u3001\u307e\u3042\u3053\u3093\u306a\u98a8\u306b string \u578b\u3092\u6e21\u3057\u305f\u308a\u53d7\u3051\u53d6\u3063\u305f\u308a\u3067\u304d\u307e\u3059\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n    var hello = new Hello();\r\n\r\n    hello.SetName(&quot;Tomoaki Masuda&quot;);\r\n    var name = hello.GetName();\r\n    Console.WriteLine($&quot;name: {name}&quot;);\r\n<\/pre>\n<p>\n\u5f53\u7136\u306e\u3053\u3068\u306a\u304c\u3089\u3001\u3053\u308c\u306f Hello \u30af\u30e9\u30b9\u5185\u3067\u30e9\u30c3\u30d7\u3057\u3066\u3044\u308b\u8a33\u3067\u3001\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n  public string GetName() {\r\n    string ret = helloswigPINVOKE.Hello_GetName(swigCPtr);\r\n    return ret;\r\n  }\r\n<\/pre>\n<p>\n\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001dllimport \u3092\u898b\u308b\u3068\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u306a\u3063\u3066\u3044\u3066\u3001string \u578b\u3092\u8fd4\u3057\u3066\u3044\u307e\u3059\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n  &#x5B;global::System.Runtime.InteropServices.DllImport(&quot;helloswig&quot;, EntryPoint=&quot;CSharp_Hello_GetName&quot;)]\r\n  public static extern string Hello_GetName(global::System.Runtime.InteropServices.HandleRef jarg1);\r\n<\/pre>\n<p>\ndllimport \u3067 string \u578b\u3092\u8fd4\u3057\u3066\u3044\u308b\u306e\u3067\u3001\u3069\u3046\u3044\u3046\u30c8\u30ea\u30c3\u30af\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u304b\u3068\u30b3\u30fc\u30c9\u3092\u8ffd\u3063\u3066\u307f\u308b\u3068\u3001\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n  protected class SWIGStringHelper {\r\n\r\n    public delegate string SWIGStringDelegate(string message);\r\n    static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);\r\n\r\n    &#x5B;global::System.Runtime.InteropServices.DllImport(&quot;helloswig&quot;, EntryPoint=&quot;SWIGRegisterStringCallback_helloswig&quot;)]\r\n    public static extern void SWIGRegisterStringCallback_helloswig(SWIGStringDelegate stringDelegate);\r\n\r\n    static string CreateString(string cString) {\r\n      return cString;\r\n    }\r\n\r\n    static SWIGStringHelper() {\r\n      SWIGRegisterStringCallback_helloswig(stringDelegate);\r\n    }\r\n  }\r\n<\/pre>\n<p>\n\u6587\u5b57\u5217\u5c02\u7528\u306e\u30d8\u30eb\u30d1\u30fc\u30af\u30e9\u30b9\u304c\u3042\u3063\u3066\u3001string \u578b\u3092\u623b\u3059\u3068\u304d\u306f\n<\/p>\n<ol>\n<li>C++ \u5074\u3067\u3053\u3053\u3067\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u30c7\u30ea\u30b2\u30fc\u30c8\u95a2\u6570\u3092\u547c\u3073\u51fa\u3059\u3002<\/li>\n<li>C# \u5074\u3067\u3042\u3089\u304b\u3058\u3081 string \u306a\u30c7\u30fc\u30bf\u3092\u4f5c\u308b\u3002<\/li>\n<li>C++ \u5074\u304b\u3089\u3001string \u306a\u30c7\u30fc\u30bf\u306e\u30dd\u30a4\u30f3\u30bf\u3092\u8fd4\u3059\u3002<\/li>\n<li>\u3053\u308c\u3092 C# \u5074\u3067 string \u578b\u3067\u53d7\u3051\u3066 string \u3068\u3057\u3066\u5229\u7528\u3059\u308b\u3002<\/li>\n<\/ol>\n<p>\n\u3068\u3044\u3046\u306a\u304b\u306a\u304b\u8208\u5473\u6df1\u3044\u3053\u3068\u3092\u3084\u3063\u3066\u3044\u307e\u3059\u3002Python \u3068\u304b Java \u306e\u30b3\u30fc\u30c9\u306f\u8ffd\u3063\u3066\u3044\u306a\u3044\u306e\u3067\u3059\u304c\u3001\u3053\u308c\u306f\u5197\u9577\u3067\u306f\u3042\u308b\u3051\u3069\u3001C#\uff08.NET\u306e\u4e16\u754c\uff09\u306e\u30de\u30cd\u30fc\u30b8\u306a\u30e1\u30e2\u30ea\u7a7a\u9593\u3067\u30c7\u30fc\u30bf\u3092\u6271\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u826f\u3044\u624b\u6bb5\u3067\u3059\u3088\u306d\u3002\n<\/p>\n<p>\n\u3063\u3066\u3001\u3053\u3068\u307e\u3067\u306f\u5206\u304b\u3063\u305f\u306e\u3067\u3059\u304c\u3001\u3058\u3083\u3042\u3053\u3053\u306e\u300c\u5197\u9577\u300d\u306a\u90e8\u5206\u306f\u3001\u672c\u6765\u306e C# \u306a\u3089\u3070\u3069\u3046\u3059\u308b\u306e\u304b\uff1f\u3063\u3066\u306e\u304c\u6b21\u3067\u3059\u3002\n<\/p>\n<p><h2>C#\u5074\u3067Marshal.PtrToStringAnsi\u3092\u4f7f\u3046<\/h2>\n<\/p>\n<p>\n\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u306f\u3001\n<\/p>\n<p>\nmoonmile\/hellodll: C++ \u306e DLL \u304b\u3089 const char *, wchar_t * \u3092\u8aad\u307f\u8fbc\u3080\u30c6\u30b9\u30c8<br \/>\n<a href=\"https:\/\/github.com\/moonmile\/hellodll\">https:\/\/github.com\/moonmile\/hellodll<\/a>\n<\/p>\n<p>\n\u306b\u3042\u308a\u307e\u3059\u3002<br \/>\nC++ \u306e\u5185\u90e8\u7684\u306b\u306f\u3001std::string \u3042\u308b\u3044\u306f std::wstring \u3092\u4f7f\u3063\u3066\u3044\u308b\u72b6\u614b\u3067\u3001C# \u3078\u306e\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306b\u3001char * \u3042\u308b\u3044\u306f wchar_t * \u3092\u4f7f\u3046\u3068\u3044\u3046\u60f3\u5b9a\u3067\u3059\u306d\u3002\n<\/p>\n<p>\n&#8211; hellodll : C++ \u306e\u5171\u6709\u30e9\u30a4\u30d6\u30e9\u30ea<br \/>\n&#8211; hello    : C# \u304b\u3089 hellodll \u3092\u547c\u3073\u51fa\u3057<br \/>\n&#8211; helloCore: .NET Core \u304b\u3089 hellodll \u306e\u547c\u3073\u51fa\u3057<br \/>\n&#8211; helloStd, helloStdCore : .NET Standard \u3067 hellodll \u3092\u547c\u3073\u51fa\u3057\u3001\u305d\u308c\u3092 .NET Core \u3067\u5229\u7528\u3059\u308b\u30d1\u30bf\u30fc\u30f3\n<\/p>\n<p>\nC++ \u5074\u3067\u306f\u3053\u3093\u306a\uff08\u4e71\u66b4\u306a\uff09\u611f\u3058\u3067\u3001\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u4f5c\u3063\u3066\u304a\u304d\u307e\u3059\u3002\u5358\u7d14\u306a\u6587\u5b57\u5217\u306e\u53d7\u3051\u6e21\u3057\u306a\u306e\u3067\u3001_str \u3084 _wstr \u306e\u4e2d\u8eab\u306f C# \u5074\u3067\u306f\u5f04\u3089\u305a\u3001C++ \u5074\u3067\u306e\u307f\u5f04\u308b\u3068\u3044\u3046\u60f3\u5b9a\u3067\u3059\u3002C# \u3067\u5f04\u3063\u305f\u3068\u304d\u306f\u3001\u3042\u3089\u305f\u3081\u3066 SetNameStr(char *) \u306e\u3088\u3046\u306b\u6587\u5b57\u5217\u3092\u6e21\u3057\u3066\u8cb0\u3048\u3070\u3044\u3044\u306e\u3067\u3059\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n#include &lt;string&gt;\r\nstatic std::string _str = &amp;quot;&amp;quot;;\r\nstatic std::wstring _wstr = L&amp;quot;&amp;quot;;\r\nextern &amp;quot;C&amp;quot; {\r\n\t__declspec(dllexport) int __stdcall Add(int x, int y) {\r\n\t\treturn x + y;\r\n\t}\r\n\r\n\t__declspec(dllexport) void __stdcall SetNameStr(char *t) {\r\n\t\t_str = std::string(t);\r\n\t}\r\n\t__declspec(dllexport) char * __stdcall GetNameStr() {\r\n\t\treturn (char*)_str.c_str();\r\n\t}\r\n\t__declspec(dllexport) void __stdcall SetNameWStr(const wchar_t *t) {\r\n\t\t_wstr = std::wstring(t);\r\n\t}\r\n\t__declspec(dllexport) const wchar_t * __stdcall GetNameWStr() {\r\n\t\treturn _wstr.c_str();\r\n\t}\r\n}\r\n<\/pre>\n<p>\n\u3053\u308c\u3092 C# \u5074\u3067\u53d7\u3051\u308b\u3068\u3001\u3053\u3093\u306a\u611f\u3058\u306b\u306a\u308a\u307e\u3059\u3002C# \u304b\u3089\u6e21\u3059\u3068\u304d\u306f string \u304c\u4f7f\u3048\u308b\u3051\u3069\u3001C++ \u304b\u3089\u8cb0\u3046\u3068\u304d\u306f IntPtr \u3067\u53d7\u3051\u307e\u3059\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;SetNameStr&quot;)]\r\n static extern void SetNameStr(string t);\r\n &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;GetNameStr&quot;)]\r\n static extern IntPtr GetNameStr();\r\n &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;SetNameWStr&quot;, CharSet = CharSet.Unicode)]\r\n static extern void SetNameWStr(string t);\r\n &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;GetNameWStr&quot;, CharSet = CharSet.Unicode)]\r\n static extern IntPtr GetNameWStr();\r\n<\/pre>\n<p>\nIntPtr \u3067\u53d7\u3051\u305f\u5024\u3092\u3001Marshal.PtrToStringAnsi \u3042\u308b\u3044\u306f\u3001Marshal.PtrToStringUni \u3067\u5909\u63db\u3057\u307e\u3059\u3002char * \u3068 wchar_t * \u306b\u5bfe\u5fdc\u3059\u308b\u308f\u3051\u3067\u3059\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\n  string s = &quot;\u3053\u3093\u306b\u3061\u306f C++ \u306e\u4e16\u754c&quot;;\r\n  SetNameStr(s);\r\n  var s1 = Marshal.PtrToStringAnsi(GetNameStr());\r\n<\/pre>\n<p>\n\u3067\u3082\u3063\u3066\u3001\u3044\u3061\u3044\u3061\u6587\u5b57\u5217\u3092\u8cb0\u3046\u305f\u3073\u306b Marshal.PtrToStringAnsi \u3092\u4f7f\u3046\u306e\u306f\u9762\u5012\u306a\u304a\u3067\u3001\u6b21\u306e\u3088\u3046\u306b\u30d8\u30eb\u30d1\u30fc\u30af\u30e9\u30b9\u3092\u4f5c\u3063\u3066\u304a\u3044\u3066\u3001\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\npublic class HelloDll\r\n{\r\n    public static void SetNameStr(string s) { _SetNameStr(s); }\r\n    public static string GetNameStr() { return Marshal.PtrToStringAnsi(_GetNameStr()); }\r\n    public static void SetNameWStr(string s) { _SetNameWStr(s); }\r\n    public static string GetNameWStr() { return Marshal.PtrToStringUni(_GetNameWStr()); }\r\n\r\n\r\n    &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;SetNameStr&quot;)]\r\n    static extern void _SetNameStr(string t);\r\n    &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;GetNameStr&quot;)]\r\n    static extern IntPtr _GetNameStr();\r\n    &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;SetNameWStr&quot;, CharSet = CharSet.Unicode)]\r\n    static extern void _SetNameWStr(string t);\r\n    &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;GetNameWStr&quot;, CharSet = CharSet.Unicode)]\r\n    static extern IntPtr _GetNameWStr();\r\n}\r\n<\/pre>\n<p>\n\u5bfe\u5fdc\u3059\u308b static \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u305b\u3070\u3088\u3044\u306e\u3067\u3059\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nstring s = &quot;\u3053\u3093\u306b\u3061\u306f C++ \u306e\u4e16\u754c&quot;;\r\nHelloDll.SetNameStr(s);\r\nvar s1 = Marshal.PtrToStringAnsi(GetNameStr());\r\nConsole.WriteLine(s1);\r\n<\/pre>\n<p>\n\u4e00\u898b\u3001\u30d8\u30eb\u30d1\u30fc\u30af\u30e9\u30b9\u306f\u5197\u9577\u306a\u611f\u3058\u304c\u3057\u307e\u3059\u304c\u3001\u30a4\u30f3\u30c6\u30ea\u30bb\u30f3\u30b9\u304c\u52b9\u304f\u3053\u3068\u3068\u3001\u540d\u524d\u7a7a\u9593\u306a\u3069\u3067\u533a\u5207\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3001C++\u306e\u77ed\u3044\u540d\u524d\u3092C#\u306e\u9577\u3044\u540d\u524d\u306b\u76f4\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3001\u3068\u3044\u3046\u30e1\u30ea\u30c3\u30c8\u304c\u3042\u308a\u307e\u3059\u3002<br \/>\n\u5c11\u3057\u9ad8\u901f\u3055\u306b\u306f\u639b\u3051\u307e\u3059\u304c\u3001\u6240\u8a6e C++\/C# \u5909\u63db\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3067\u9045\u304f\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u305d\u3053\u306f\u6c17\u306b\u3057\u306a\u3044\u3053\u3068\u306b\u3057\u307e\u3059\u3002\n<\/p>\n<p><h2>C++\u3068.NET Standard\/Core \u306e\u95a2\u4fc2<\/h2>\n<\/p>\n<p>\n\u8a66\u3057\u306b\u3001.NET Standard \u3092\u7d4c\u7531\u3057\u3066\u307f\u305f\u306e\u304c\u3001helloStd, helloStdCore \u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u3059\u3002\n<\/p>\n<p>\n\u4e00\u5ea6\u3001.NET Standard \u306e\u30af\u30e9\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f5c\u6210\u3057\u3066\u304a\u3044\u3066\u3001\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\npublic class HelloDll\r\n{\r\n    public static void SetNameStr(string s) { _SetNameStr(s); }\r\n    public static string GetNameStr() { return Marshal.PtrToStringAnsi(_GetNameStr()); }\r\n    public static void SetNameWStr(string s) { _SetNameWStr(s); }\r\n    public static string GetNameWStr() { return Marshal.PtrToStringUni(_GetNameWStr()); }\r\n\r\n\r\n    &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;SetNameStr&quot;)]\r\n    static extern void _SetNameStr(string t);\r\n    &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;GetNameStr&quot;)]\r\n    static extern IntPtr _GetNameStr();\r\n    &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;SetNameWStr&quot;, CharSet = CharSet.Unicode)]\r\n    static extern void _SetNameWStr(string t);\r\n    &#x5B;DllImport(&quot;hellodll&quot;, EntryPoint = &quot;GetNameWStr&quot;, CharSet = CharSet.Unicode)]\r\n    static extern IntPtr _GetNameWStr();\r\n}\r\n<\/pre>\n<p>\n.NET Core \u304b\u3089 .NET Standard \u306e\u30af\u30e9\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u53c2\u7167\u8a2d\u5b9a\u3055\u305b\u3066\u5b9f\u884c\u3068\u3044\u3046\u30b9\u30bf\u30a4\u30eb\u3067\u3059\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nstatic void Main(string&#x5B;] args)\r\n{\r\n    Console.WriteLine(&quot;Test helloCoreStd&quot;);\r\n    string s = &quot;\u3053\u3093\u306b\u3061\u306f C++ \u306e\u4e16\u754c&quot;;\r\n\r\n    HelloDll.SetNameStr(s);\r\n    var s1 = HelloDll.GetNameStr();\r\n    Console.WriteLine(s1);\r\n\r\n    HelloDll.SetNameWStr(s + &quot; in Unicode&quot;);\r\n    var s2 = HelloDll.GetNameWStr();\r\n    Console.WriteLine(s2);\r\n    Console.WriteLine(&quot;end&quot;);\r\n}\r\n<\/pre>\n<p>\n\u5148\u306e\u3001.NET Core \u304b\u3089 C++ \u76f4\u63a5\u547c\u51fa\u3057\u3068\u4f55\u304c\u9055\u3046\u306e\u304b\u3068\u3044\u3046\u3068\u3001\u3044\u3063\u305f\u3093 .NET Standard \u3067\u5305\u3080\u3053\u3068\u306b\u3088\u3063\u3066\u3001.NET Core \u4ee5\u5916\u306e\u74b0\u5883\u3067\u52d5\u4f5c\u304c\u3067\u304d\u308b\u3068\u3044\u3046\u8a71\u3067\u3059\u3002C++ \u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u74b0\u5883\u3054\u3068\u306b\u30d3\u30eb\u30c9\u3057\u3066\u914d\u5e03\uff08Windows\/Ubuntu\/Raspberry Pi\u306e\u3088\u3046\u306b\uff09\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u3059\u304c\u3001.NET Standard \u306e\u30af\u30e9\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea\u306f\u305d\u306e\u307e\u307e\u5404\u7a2e\u306e .NET \u958b\u767a\u74b0\u5883\u3067\u5229\u7528\u3067\u304d\u308b\u3068\u3044\u3046\u8a33\u3067\u3059\u306d\u3002\u6240\u8b02\u3001\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u30af\u30e9\u30b9\u306e\u4ee3\u308f\u308a\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u305d\u3046\u306a\u308b\u3068\u3001\u3053\u306e\u30af\u30e9\u30b9\uff08\u30a2\u30bb\u30f3\u30d6\u30ea\uff09\u3092\u5229\u7528\u3057\u3066\u3001Xamarin.Android\/iOS \u3067\u5229\u7528\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\u3068\u3044\u3046\u8a71\u3067\u3059\u3002\u305d\u3046\u3059\u308b\u3068\u3001\u81ea\u524d\u306e\u5c0f\u3055\u306a C++ \u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u3044\u3061\u3044\u3061 C# \u306b\u66f8\u304d\u66ff\u3048\u308b\u3053\u3068\u306a\u304f\uff08\u3042\u308b\u3044\u306f Marshal.* \u3084 unsafe \u3092\u99c6\u4f7f\u3059\u308b\u3053\u3068\u306a\u304f\uff09\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u74b0\u5883\u306b\u7d44\u307f\u8fbc\u3081\u308b\u306e\u3067\u306f\u306a\u3044\u304b\u306a\u3001\u3068\u601d\u3063\u305f\u308a\u3002\u3053\u306e\u3042\u305f\u308a\u306f\u3001\u3082\u3046\u5c11\u3057\u898b\u3066\u3044\u304b\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u304c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5185\u90e8\u30b3\u30fc\u30c9\u3092 std::string\/char * \u306b\u3059\u308b\u304b std::wstring\/wchar_t * \u306b\u3059\u308b\u304b\u3067\u3001SWIG \u306e\u6319\u52d5\u304c\u5909\u308f\u308b\u3088\u3046\u306a\u611f\u3058\u306a\u306e\u3067\u3001\u305d\u306e\u524d\u6bb5\u968e\u306e\u30c6\u30b9\u30c8 \u623b\u308a\u5024\u3092string\u578b\u306b\u3059\u308b SWIG &hellip; <a href=\"https:\/\/www.moonmile.net\/blog\/archives\/8962\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,23,22],"tags":[],"class_list":["post-8962","post","type-post","status-publish","format-standard","hentry","category-dev","category-csharp","category-c"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/8962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=8962"}],"version-history":[{"count":3,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/8962\/revisions"}],"predecessor-version":[{"id":8965,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/8962\/revisions\/8965"}],"wp:attachment":[{"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=8962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=8962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=8962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}