File: stub.c

package info (click to toggle)
swi-prolog 3.1.0-2
  • links: PTS
  • area: main
  • in suites: slink
  • size: 8,772 kB
  • ctags: 12,869
  • sloc: ansic: 43,657; perl: 12,577; lisp: 4,359; sh: 1,534; makefile: 798; awk: 14
file content (43 lines) | stat: -rw-r--r-- 1,608 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*  $Id: stub.c,v 1.1 1992/07/17 12:40:36 jan Exp $

    Copyright (c) 1991 Jan Wielemaker. All rights reserved.
    jan@swi.psy.uva.nl

    Purpose: Skeleton for extensions
*/

#include <stdio.h>
#include <SWI-Prolog.h>

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C-extension   can  either  be   loaded  through the   foreign language
interface  implemented   by   load_foreign/[1,2,5]  or  through static
linking.  The latter  mechanism  is  to be  used if  the first is  not
ported to your machine/operating system.  Static linking is also to be
preferred  for large   applications   as  it  puts  the   text  in the
text-section of the (unix) process rather  than te  data section.  The
text-section  of  a  process  is  normally write-protected  (providing
better protection) and shared between multiple copies of the program.

To create a statically linked executable, perform the following steps:

  1) Make the file `pl.o' containing all of SWI-Prolog using
     `make pl.o' in the machine-directory and install it.
  2) Make a copy of this file.  In this copy:
  3) Put the right #include directives
  4) Fill the table below.  
  5) Link pl.o with this file and the .o files defining your application.
     USE STATIC LINKING!!!

If there are prolog parts involved:

  6) Start the image; load the prolog and create a state using
     save_program/2.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

PL_extension PL_extensions [] =
{
/*{ "name",	arity,  function,	PL_FA_<flags> },*/

  { NULL,	0, 	NULL,		0 }	/* terminating line */
};