		Prolog <-> C interface examples


This directory contains examples presented in the documentation. To build:

	make

examp.pl / examp_c.c: examples calling C from Prolog and C from Prolog

new_main.pl / new_main_c.c: example defining a new main function.


WINDOWS
-------

In Microsoft Windows if you intend to use the gplc compiler as described in
the documentation you need to ascertain the following conditions are
met:

   - for the port compiled with MS Visual C++ (tested with version
     6.0) you'll need to have NASM (the Netwide Assembler available at
     http://nasm.sourceforge.net/) installed and the 'cl' compiler
     (used mainly as linker by GNU Prolog) available in your session
     path.

   - for the ports compiled either with MinGW or Cygwin, the gcc
     toolchain must be installed and available in your session
     path.

Observing these needs you'll also will be able to do the mixed
language programming, as the examples included in the ExamplesC
directory. However you'll need to write your own Makefile as the one
provided is for gplc calling 'gcc' and the options passed by GNU
Prolog will not work, here is an example for nmake and MSVC++ compiler:


GPLC = gplc
CFLAGS=-c -W4

EXECS=examp.exe new_main.exe
.SUFFIXES: .obj .c .wam .pl

.pl.obj:
	$(GPLC) $(CFLAGS) $<

.c.obj:
	$(GPLC) $(CFLAGS) $<

all: $(EXECS)

examp.exe: examp.obj examp_c.obj
	$(GPLC) -o $@ $**

new_main.exe: new_main.obj new_main_c.obj
	$(GPLC) -o $@ $**

clean:
	rm -f $(EXECS) *.obj




