我在C中创建了一个dll,您可以用这个方法看到:
namespace Dll
{
public class Check
{
public string JoinString(string fristName, string Lastname)
{
return fristName + " " + Lastname;
}
}
}
我构建了这个dll并想在另一个应用程序中使用它
DLLImport
如你所见:
[DllImport("Dll.dll", EntryPoint = "JoinString")]
public static extern string JoinString (string fristName, string Lastname);
private void button1_Click(object sender, EventArgs e)
{
string s = JoinString("aaa", "bbbb");
MessageBox.Show(s.ToString());
}
但我有个错误:
An unhandled exception of type 'System.EntryPointNotFoundException' occurred in WindowsFormsApplication3.exe
Additional information: Unable to find an entry point named 'JoinString' in DLL 'Dll.dll'.