aboutsummaryrefslogtreecommitdiffstats
path: root/testdl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'testdl.cpp')
-rw-r--r--testdl.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/testdl.cpp b/testdl.cpp
new file mode 100644
index 0000000..7e21431
--- /dev/null
+++ b/testdl.cpp
@@ -0,0 +1,49 @@
+// testdl.cpp
+
+#ifdef _Windows
+#define EXTERN extern "C" __declspec (dllexport)
+#else
+#define EXTERN extern "C"
+#endif
+
+#ifdef _Windows
+#include <windows.h>
+
+#ifdef __BORLANDC__
+#pragma hdrstop
+#include <condefs.h>
+// string (iterator, iterator) gives this warnig:
+#pragma warn -8012
+#else
+#error Compiler not tested.
+#endif
+
+#endif
+
+#include <iostream>
+#include <string>
+
+using std::string;
+
+#ifdef _Windows
+
+#pragma argsused
+int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
+{
+ return 1;
+}
+
+#endif
+
+EXTERN int testfunc (int nparams, int * param)
+{
+ if (nparams != 1)
+ return 1;
+ string * pstr= reinterpret_cast <string *> (param [0]);
+ string nstr ( pstr->rbegin (), pstr->rend () );
+ // Do not use * pstr= nstr nor assign a string longer than * pstr.
+ pstr->assign (nstr);
+ return 0;
+}
+
+// Fin de testdl.cpp
Un proyecto texto-plano.xyz