Issue initializing Prolog Engine in Visual C#

View: New views
2 Messages — Rating Filter:   Alert me  

Issue initializing Prolog Engine in Visual C#

by Vineet Kashyap :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Every time i run the following code i get a FileNotFoundException was unhandled
(Exception from HRESULT 0x8007007E)

I have set the enviromnet variable to point to the bin location

How can i fix this ? Any help would be highly appreciated

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SbsSW.SwiPlCs;
using SbsSW.SwiPlCs.Exceptions;

namespace WTSS
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
           
            StreamReader myFile = new StreamReader("c:\\TS.pl");
            string myString = myFile.ReadToEnd();

            myFile.Close();

            // build the parameter string to Initialize PlEngine with the generated file
            string[] param = { "-q", "-f", myString };
            Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"c:\\program files\pl\boot32.prc");

            PlEngine.Initialize(param);
            if (!PlEngine.IsInitialized)
            {
                MessageBox.Show("Sorry: Cannot initialize Prolog engine");
            }
           
        }
    }
}

Re: Issue initializing Prolog Engine in Visual C#

by Jan Wielemaker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I know nothing about .NET, but ....

On Wednesday 01 July 2009 01:42:21 Vineet Kashyap wrote:
>             Environment.SetEnvironmentVariable("SWI_HOME_DIR",
> @"c:\\program files\pl\boot32.prc");

SWI_HOME_DIR is a directory, not a file.  Must be "c:\\program files\pl"

        --- Jan

_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog