How to avoid using the plld.exe utility in VS2008 (for linking C++ and Prolog codes)
- by Joshua Green
Here is my code in its entirety:
Trying "listing." at the Prolog prompt that pops up when I run the program confirms that my Prolog source code has been loaded (consulted).
#include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdafx.h>
using namespace std;
#include "Windows.h"
#include "ctype.h"
#include "SWI-cpp.h"
#include "SWI-Prolog.h"
#include "SWI-Stream.h"
int main(int argc, char** argv)
{
argc = 4;
argv[0] = "libpl.dll";
argv[1] = "-G32m";
argv[2] = "-L32m";
argv[3] = "-T32m";
PL_initialise(argc, argv);
if ( !PL_initialise(argc, argv) )
PL_halt(1);
PlCall( "consult(swi('plwin.rc'))" );
PlCall( "consult('hello.pl')" );
PL_halt( PL_toplevel() ? 0 : 1 );
}
So this is how to load a Prolog source code (hello.pl) at run time into VS2008 without having to use plld at the VS command prompt.