接口prolog与C# [英] interface prolog with C#

查看:349
本文介绍了接口prolog与C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试接口C#与序言
I使用了此链接:
在此输入链接的描述

i try to interface C# with prolog i have used this link : enter link description here

我添加了SwiPlCs.dll为我的项目的引用,然后使用第一个代码的文档中。

i have added the SwiPlCs.dll as a reference to my project,then use the first code in the documentation

using System;
using SbsSW.SwiPlCs;


namespace HelloWorldDemo

{

class Program
{
    static void Main(string[] args)
    {
        //Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"the_PATH_to_boot32.prc");
        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 (PlQuery 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 child's from uwe:");
                q.Variables["P"].Unify("uwe");
                foreach (PlQueryVariables v in q.SolutionVariables)
                    Console.WriteLine(v["C"].ToString());
            }
            PlEngine.PlCleanup();
            Console.WriteLine("finshed!");
        }
    }
}

}

但例外总是去..它说:

but an exception always goes .. it's say that :

指定的模块找不到。 (从HRESULT异常:0x8007007E

The specified module could not be found. (Exception from HRESULT: 0x8007007E

在SWI-序言他们说这个错误:

in the SWI-prolog they have say about this error:

如果libswipl.dll或它的一个依赖不能发现你会recive像
System.IO.FileNotFoundException错误:达斯angegebene MODUL wurde nicht gefunden(Ausnahme冯HRESULT:0x8007007E)

If libswipl.dll or one of its dependencies could not found you will recive an error like System.IO.FileNotFoundException: Das angegebene Modul wurde nicht gefunden. (Ausnahme von HRESULT: 0x8007007E)

我抄从程序bin中libswipl.dll到我的斌/ debug文件夹在我的项目,但它还是同样的问题。

i have copied the libswipl.dll from the program bin to my bin/debug folder in my project but it still the same problem .

我有什么做的?
谢谢

what i have to do ?? Thanks

推荐答案

你有没有宣布SWI_HOME_DIR?应该向c`\Program Files\pl点

Have you declared SWI_HOME_DIR ? Should point towards c`\Program Files\pl

用C#接口并不适用于Windows 7 64位,Visual Studio 2010中professionnal
似乎是一个错误,乌韦Lesta应该很快就会解决的bug。

Interface with C# doesn't works with Windows 7 64 bits, Visual Studio 2010 professionnal. Seems to be a bug, Uwe Lesta should fix the bug soon.

这篇关于接口prolog与C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆