3
|
1 |
/*
|
|
2 |
* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
#include "t_oedll.h"
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
// construct/destruct
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
EXPORT_C CMessenger* CMessenger::NewLC(CConsoleBase& aConsole, const TDesC& aString)
|
|
31 |
|
|
32 |
{
|
|
33 |
|
|
34 |
CMessenger* self=new (ELeave) CMessenger(aConsole);
|
|
35 |
|
|
36 |
CleanupStack::PushL(self);
|
|
37 |
|
|
38 |
self->ConstructL(aString);
|
|
39 |
|
|
40 |
return self;
|
|
41 |
|
|
42 |
}
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
CMessenger::~CMessenger() // destruct - virtual, so no export
|
|
47 |
|
|
48 |
{
|
|
49 |
|
|
50 |
delete iString;
|
|
51 |
|
|
52 |
}
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
EXPORT_C void CMessenger::ShowMessage()
|
|
57 |
|
|
58 |
{
|
|
59 |
|
|
60 |
_LIT(KFormat1,"%S\n");
|
|
61 |
|
|
62 |
iConsole.Printf(KFormat1, iString); // notify completion
|
|
63 |
|
|
64 |
}
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
// constructor support
|
|
69 |
|
|
70 |
// don't export these, because used only by functions in this DLL, eg our NewLC()
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
CMessenger::CMessenger(CConsoleBase& aConsole) // first-phase C++ constructor
|
|
75 |
|
|
76 |
: iConsole(aConsole)
|
|
77 |
|
|
78 |
{
|
|
79 |
|
|
80 |
}
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
void CMessenger::ConstructL(const TDesC& aString) // second-phase constructor
|
|
85 |
|
|
86 |
{
|
|
87 |
|
|
88 |
iString=aString.AllocL(); // copy given string into own descriptor
|
|
89 |
|
|
90 |
}
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
class MY_MY
|
|
95 |
|
|
96 |
{
|
|
97 |
|
|
98 |
public:
|
|
99 |
|
|
100 |
MY_MY(int aA){iA = aA;}
|
|
101 |
|
|
102 |
int iA;
|
|
103 |
|
|
104 |
int get() { return iA;}
|
|
105 |
|
|
106 |
};
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
class MY_TYPE
|
|
111 |
|
|
112 |
{
|
|
113 |
|
|
114 |
public:
|
|
115 |
|
|
116 |
MY_TYPE(MY_MY& aA){memcpy(&iA, &aA, sizeof(iA));}
|
|
117 |
|
|
118 |
int iA;
|
|
119 |
|
|
120 |
int get() { return iA;}
|
|
121 |
|
|
122 |
};
|
|
123 |
|
|
124 |
|
|
125 |
|
|
126 |
EXPORT_C int bar()
|
|
127 |
|
|
128 |
{
|
|
129 |
|
|
130 |
MY_MY amymy(0x1234);
|
|
131 |
|
|
132 |
static MY_TYPE mytype(amymy);
|
|
133 |
|
|
134 |
myfoo();
|
|
135 |
|
|
136 |
return mytype.get();
|
|
137 |
|
|
138 |
}
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
extern "C" {
|
|
143 |
|
|
144 |
EXPORT_C int myfoo()
|
|
145 |
|
|
146 |
{
|
|
147 |
|
|
148 |
return 0x1234;
|
|
149 |
|
|
150 |
}
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
}
|
|
155 |
|