首页 > 解决方案 > 可以 [DllImport(“ ”)] , DLL 使用保护软件 C# Winform 后不报错

问题描述

我正在使用 C# WinForm。我有一个非托管 DLL ( nip.dll),我把它放在同一个目录中。

使用保护软件(Obfuscator)后,这些字符不是“snip.dll”,无法导入DLL。

有什么解决办法吗?或者,我可以使用另一种语言(例如 C++)来做到这一点吗?

[DllImport(@"nip.dll", EntryPoint = "CreateInstance")]
static extern IntPtr nip_ctor(uint pID);

public nip(int pID)
{
    //pInstance = nip_ctor((uint)pID);

    try
    {
        pInstance = nip_ctor((uint)pID);
    }
    catch
    {
        MessageBox.Show("ERROR DLL");
        Application.Exit();
    }
}

标签: c#c++cwinforms

解决方案


推荐阅读