added examples
[libt2n] / examples-codegen / example1 / t2nexample.cpp
diff --git a/examples-codegen/example1/t2nexample.cpp b/examples-codegen/example1/t2nexample.cpp
new file mode 100644 (file)
index 0000000..8d5e1e6
--- /dev/null
@@ -0,0 +1,11 @@
+// include automatically generated code
+#include "t2nexample_common.hxx"
+
+//! example procedure to export (LIBT2N_EXPORT tells the code generator that we want to export this procedure)
+LIBT2N_EXPORT std::string testfunc(std::string str) 
+{
+    // exceptions derived from libt2n::t2n_exception are passed to the client transparently
+    if (str=="throw")
+        throw libt2n::t2n_runtime_error("throw me around");
+    return str+", testfunc() was here";
+}