با سلام.
من یک DLL در دلفی نوشتهام که حاوی یک پارامتر از نوع String است. در هنگام اجرای برنامه از خطی که قرار است تابع فوق را فراخوانی کند این ایراد را میگیرد:
An unhandled exception of type 'System.NullReferenceException' occurred in Invoke_CS.exe
Additional information: Object reference not set to an instance of an object.
این کد نوشته شده در #C است:
using System;
using System.Runtime.InteropServices;
namespace Invoke_CS
{
class Class1
{
[DllImport("EchoStr.dll")]
public static extern bool CheckString(string s);
[STAThread]
static void Main(string[] args)
{
string x="Reza";
if(CheckString(x)==true)
{
Console.WriteLine("True");
}
else
{
Console.WriteLine("False");
}
Console.ReadLine();
}
}
}
مشکل از چیست؟