summaryrefslogtreecommitdiff
path: root/ipl/packs/loadfuncpp/doc/divide.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/packs/loadfuncpp/doc/divide.cpp')
-rw-r--r--ipl/packs/loadfuncpp/doc/divide.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/ipl/packs/loadfuncpp/doc/divide.cpp b/ipl/packs/loadfuncpp/doc/divide.cpp
new file mode 100644
index 0000000..a9f3d99
--- /dev/null
+++ b/ipl/packs/loadfuncpp/doc/divide.cpp
@@ -0,0 +1,20 @@
+
+
+/* Example of a C++ extension to icon via loadfunc,
+ * without garbage collection difficulties.
+ * Type 'make iexample' to build.
+ * Carl Sturtivant, 2008/3/16
+ */
+
+
+#include "loadfuncpp.h"
+using namespace Icon;
+
+extern "C" int div(value argv[]) {
+ safe x(argv[1]), y(argv[2]), z;
+ z = ( x/y, x%y );
+ argv[0] = z;
+ return SUCCEEDED;
+}
+
+