js ctypes和windows xp中的c#非托管dll

本文关键字:dll 中的 ctypes windows xp js | 更新日期: 2024-10-20 02:19:09

我有一个非托管的c#dll(使用Giesecke Dlexport)。当我在Windows 7,8 64/32位中用js ctypes打开这个dll时,它可以工作,但如果我在Windows XP上尝试它,我会得到错误:"无法打开库"。

我使用.Net Framework 2.0制作了这个dll。

using RGiesecke.DllExport;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace MinhaDll
{
    public class Dll
    {
        [DllExport("getA", CallingConvention = CallingConvention.StdCall)]
        [return: MarshalAs(UnmanagedType.LPStr)]
        public static string getA()
        {
            return "a";
        }
        [DllExport("getB", CallingConvention = CallingConvention.StdCall)]
        [return: MarshalAs(UnmanagedType.LPStr)]
        public static string getB()
        {
            return "b";
        }
    }
}

就像这个问题,但对我没有帮助:

Robert Giesecke库无法在Windows XP 下运行的非托管DLL导出

js ctypes和windows xp中的c#非托管dll

解决了它!

我使用RGiesecke和.NET Framework 2.0的DLLExporter在C#中从头开始创建了一个新的DLLx86,现在它可以工作了。