I am new to Prolog and C#. When I try to integrate Prolog with C# I found some errors. I followed the instructions written at SWI-Prolog website and uses its sample code. When I run the application it give the following error. someone can guide me what to do?? thank you in advance
Error: Message: An unhandled exception of type 'System.AccessViolationException' occurred in SwiPlCs.dll
Code here:
Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"C:\Program Files (x86)\swipl\");
Environment.SetEnvironmentVariable("PATH", @"C:\Program Files (x86)\swipl\");
Environment.SetEnvironmentVariable("PATH", @"C:\Program Files (x86)\swipl\bin\");
if (!PlEngine.IsInitialized)
{
String[] param = { "-q"}; // suppressing informational and banner messages
PlEngine.Initialize(param);
PlQuery.PlCall("assert(father(martin, inka))");
PlQuery.PlCall("assert(father(uwe, gloria))");
PlQuery.PlCall("assert(father(uwe, melanie))");
PlQuery.PlCall("assert(father(uwe, ayala))");
using (var q = new PlQuery("father(P, C), atomic_list_concat([P,' is_father_of ',C], L)"))
{
foreach (PlQueryVariables v in q.SolutionVariables)
Console.WriteLine(v["L"].ToString());
Console.WriteLine("all children from uwe:");
q.Variables["P"].Unify("uwe");
foreach (PlQueryVariables v in q.SolutionVariables)
Console.WriteLine(v["C"].ToString());
}
PlEngine.PlCleanup();
Console.WriteLine("finshed!");
}