Recently, I was learning to make a form program Demo. After calling the DLL, it crashed and flashed back.
Below is the code:
`[DllImport("vspdctl.dll", CallingConvention = CallingConvention.StdCall)]
public static extern bool CreatePair(string comName1, string comName2);
public bool CreatePort(string com1,string com2)
{
string s = com1;
string s2 = com2;
bool IsCrateture=CreatePair(com1, com2);
return IsCrateture;
}`
`private void button1_Click(object sender, EventArgs e)
{
bool IsCrateSeccuss = GetVSPD.CreatePort(CreatePortName.Text, CreatePortName2.Text);
if (IsCrateSeccuss)
{
MessageBox.Show("OK");
}
else
{
MessageBox.Show("Fail");
}`
Reported this error, the error is as follows:
System.DllNotFoundException: Unable to load DLL 'vspdctl.dll': A dynamic link library (DLL) initialization routine failed.
Not sure what caused it