Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Interfacing SWI Prolog to the Visual Studio 2012

I have a program that interfacing SWI-Prolog in Visual Studio. Previously, I used VS2010 (XP) and everything works fine. Then I upgrade my VS to become VS2012 (Win7) and now I have a problem in my code.

When it comes to the following code:

PlEngine.Initialize(param);

it always gives me the following exception message:

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

Can anybody spot what mistake that I made or if possible some modification that I have to do, due to the upgrading process?

Additional information regarding my code:

  • I used the most updated swiPLCs library (version: 1.1.60301.0)
  • my 'param' in my code above is: string[] param = { "-q", "-f", @"c:\program files (x86)\pl\"};
  • I have set the path environment variable to: c:\program files (x86)\pl\ and c:\program files (x86)\pl\bin
  • I have this setting in my code: Environment.SetEnvironmentVariable("SWI_HOME_DIR", Global.g_prologLocation);
  • I had the reference to: swiPLcs.dll
  • I already tried to use the SWIProlog 64 bit, but I still have the same problem

Any help is really appreciated.

Many thanks

like image 427
Budi Hartanto Avatar asked Jan 28 '13 03:01

Budi Hartanto


1 Answers

I finally got the answer myself. Unlike VS2010, In VS2012 it seems that you have to add SWI-Prolog package into VS2012. So add SWI.Prolog package using Nuget. How?

See: https://nuget.org/packages/SWI.Prolog

And VS2012 will recognize the SWI.Prolog now.

Thanks anyway

like image 70
Budi Hartanto Avatar answered Sep 28 '22 02:09

Budi Hartanto