如何更正Python Proj中的call C#dll方法

2024-05-29 06:13:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我用.NET4.5用C创建了一个简单的类库。为x86 cpu构建。我把它用在了Pyhton项目中。但方法在调用时并没有显示正确的结果。在

using RGiesecke.DllExport;    

    public static class SimpleLib
    {
        [DllExport("GetHelloWorld", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl)]
        public static string GetHelloWorld()
        {
            return "Hello World";
        }

        [DllExport("ReturnMyString", CallingConvention = System.Runtime.InteropServices.CallingConvention.Cdecl)]
        public static string ReturnMyString(string value)
        {
            return value;
        }
    }

我用Python称之为:

^{pr2}$

返回此消息:

<_FuncPtr object at 0x037C0EB8>


Tags: stringreturnvaluestatic类库cpupublicsystem

热门问题