diff --git a/Doc/Manual/Pike.html b/Doc/Manual/Pike.html new file mode 100644 index 000000000..c258c0a23 --- /dev/null +++ b/Doc/Manual/Pike.html @@ -0,0 +1,129 @@ + + +
+
+
+This chapter covers most SWIG features, but certain low-level details
+are covered in less depth than in earlier chapters. At the very
+least, make sure you read the "SWIG Basics"
+chapter.
+
++To build a C extension module for Pike, run SWIG using the -pike option : +%module example+
%{
#include "example.h"
%}
int fact(int n);
++If you're building a C++ extension, be sure to add the -c++ option: +$ swig -pike example.i+
++This creates a single source file named example_wrap.c (or example_wrap.cxx, if you +ran SWIG with the -c++ option). +The SWIG-generated source file contains the low-level wrappers that need +to be compiled and linked with the rest of your C/C++ application to +create an extension module.$ swig -c++ -pike example.i+
+ +The name of the wrapper file is derived from the name of the input +file. For example, if the input file is example.i, the name +of the wrapper file is example_wrap.c. To change this, you +can use the -o option: +
++$ swig -pike -o pseudonym.c example.i+
+
++There doesn't seem to be any way to get Pike itself to reveal the +location of these files, so you may need to hunt around for them. +You're looking for files with the names global.h, program.h +and so on. + +/usr/local/pike/7.4.10/include/pike+
+ ++$ pike +Pike v7.4 release 10 running Hilfe v3.5 (Incremental Pike Frontend) +> import example; +> fact(4); +(1) Result: 24 +
+ +creates a new built-in function example.fact(n) that works +exactly as you'd expect it to: + ++%module example + +int fact(int n); +
+ ++> import example; +> fact(4); +(1) Result: 24 +
+ +will result in two functions, Foo_get() and Foo_set(): + ++%module example + +double Foo; +
+ ++> import example; +> Foo_get(); +(1) Result: 3.000000 +> Foo_set(3.14159); +(2) Result: 0 +> Foo_get(); +(3) Result: 3.141590 +