aboutsummaryrefslogtreecommitdiffstats
path: root/testdl.cpp
blob: 7e2143196af34f86cb91542f0e220298c2321d18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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