1libppl_c(3)                    libppl_c overview                   libppl_c(3)
2
3
4

NAME

6       libppl_c - the C interface of the Parma Polyhedra Library
7

SYNOPSIS

9       #include <ppl_c.h>
10
11       cc file.c -lppl
12
13

DESCRIPTION

15       This  is  a  short  overview  on how to use the Parma Polyhedra Library
16       (PPL) in your C programs on Unix-like operating systems.  Note that the
17       PPL  has  interfaces  also  for C++, Java, OCaml and a number of Prolog
18       systems: look elsewhere for documentation on those.  Note also that the
19       present  document  does  not  describe  the  library functionality, its
20       classes or its methods and functions: see The Parma  Polyhedra  Library
21       User's  Manual (version 1.2) and The Parma Polyhedra Library C Language
22       Interface User's Manual (version 1.2) for this kind of information.
23
24

INCLUDING THE HEADER FILE

26       The C interface of the PPL has only one header file, named ppl_c.h.  So
27       your program should contain a directive of the form
28
29       #include <ppl_c.h>
30
31       Of  course,  you  must make sure you installed the PPL in a place where
32       the compiler can find it, either by itself or with the help of a  suit‐
33       able -Idir command line option (see the file INSTALL for information on
34       how to configure the library so that it is installed in  the  place  of
35       your choice).
36
37

INITIALIZING AND FINALIZING THE LIBRARY

39       In  order  to  initialize the Parma Polyhedra Library you must call the
40       function
41
42       int ppl_initialize(void)
43
44       before using any of its functionalities.  It is also  a  good  norm  to
45       call the function
46
47       int ppl_finalize(void)
48
49       when you are done with the library.
50
51

USING THE LIBRARY

53       Keeping  in  mind  that there is no substitute for a careful reading of
54       The Parma Polyhedra Library User's Manual (version 1.2) and  The  Parma
55       Polyhedra  Library C Language Interface User's Manual (version 1.2) you
56       can find examples of use  in  the  directories  interfaces/C/tests  and
57       demos/ppl_lpsol of the source distribution.
58
59

LINKING WITH THE LIBRARY

61       Linking  with  the  C  interface of the Parma Polyhedra Library is best
62       done using the C compiler itself: usually, specifying the -lppl_c  com‐
63       mand  line  option  is enough.  In fact, if you use a shared version of
64       the library, this automatically records the  dependency  from  the  PPL
65       core  and  the  GMP  libraries, something that the linker ought to deal
66       with gracefully.  Otherwise you will have to add -lppl -lgmpxx -lgmp to
67       the  command  line.   Things  are more complex if you installed the PPL
68       into some nonstandard place.  In this case you will  have  to  use  the
69       -Ldir  option and, if you use a shared version of the library, possible
70       take further steps: see the  documentation  of  your  system  for  more
71       information  on  this  subject (the Program Library HOWTO is especially
72       valuable for GNU/Linux users).
73
74

RETURN VALUES

76       All the PPL C interface functions return an int: a negative value means
77       that  an  error  occurred.   See The Parma Polyhedra Library C Language
78       Interface User's Manual (version 1.2) for the error codes.
79
80

IMPLEMENTING MEMORY-GUARDED COMPUTATIONS

82       One of the interesting features of the Parma Polyhedra Library  is  the
83       possibility to implement memory-guarded computations.  The idea is that
84       you can limit the amount of virtual memory available  to  the  process,
85       launch   a   PPL   computation,   and   be   ready  to  be  returned  a
86       PPL_ERROR_OUT_OF_MEMORY error code.  You can then take the  appropriate
87       corrective  measures  (e.g.,  simplify the polyhedra and/or select less
88       precise though less complex algorithms), and restart  the  computation.
89       In  order  to  do that, you should define alternative memory allocation
90       functions for GMP that throw  std::bad_alloc  upon  memory  exhaustion.
91       See libppl(3) for instructions on how to do that.
92
93

USING NATIVE FLOATING POINT NUMBERS

95       At initialization time, the Parma Polyhedra Library sets the FPU round‐
96       ing mode in a way that allows its floating-point-based computations  to
97       be  conservative  (i.e., possibly approximated but correct) and reason‐
98       ably efficient.  In case your application itself uses  native  floating
99       point  numbers  and relies on a particular rounding mode (if you are in
100       doubt, assume that it does rely on round-to-nearest to be  in  effect),
101       you should use the function
102
103       int ppl_restore_pre_PPL_rounding()
104
105       after  the  PPL  initialization  and before using native floating point
106       numbers in the application.  If  your  application  does  not  use  any
107       floating-point-based  PPL  abstraction,  no  further  measure should be
108       taken.  Otherwise, it is imperative to call the function
109
110       int ppl_set_rounding_for_PPL()
111
112       before invoking any PPL interface related to such abstractions.
113
114
115

SEE ALSO

117       ppl-config(1)
118
119       libppl(3)
120
121       Roberto Bagnara, Patricia M. Hill,  and  Enea  Zaffanella.   The  Parma
122       Polyhedra  Library  User's  Manual (version 1.2), available (in several
123       formats) at http://bugseng.com/products/ppl/ .
124
125       Roberto Bagnara, Patricia M. Hill,  and  Enea  Zaffanella.   The  Parma
126       Polyhedra  Library  C  Language  Interface User's Manual (version 1.2),
127       available (in several formats) at http://bugseng.com/products/ppl/ .
128
129       David A. Wheeler.  Program Library HOWTO, available  (in  several  for‐
130       mats) at http://www.dwheeler.com/program-library/ .
131
132

AVAILABILITY

134       The  latest version of the Parma Polyhedra Library and all the documen‐
135       tation is available at http://bugseng.com/products/ppl/ .
136
137

AUTHOR

139       See the file CREDITS in the source  distribution  or  use  the  command
140       ppl-config --credits for a list of contributors.
141
142

REPORTING BUGS

144       Report bugs to <ppl-devel@cs.unipr.it>.
145
146
148       Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it> Copyright
149       (C) 2010-2016 BUGSENG srl (http://bugseng.com)
150       This is free software; see the file COPYING in the source  distribution
151       or  use  the  command ppl-config --copying to obtain the copying condi‐
152       tions.  There is NO warranty; not even for MERCHANTABILITY  or  FITNESS
153       FOR A PARTICULAR PURPOSE.
154
155
156
157PPL 1.2                          February 2016                     libppl_c(3)
Impressum