10 <!DOCTYPE concept |
10 <!DOCTYPE concept |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
12 <concept id="GUID-64D2B0E2-BB5D-4009-ACE5-7A3503016341" xml:lang="en"><title>Troubleshooting |
12 <concept id="GUID-64D2B0E2-BB5D-4009-ACE5-7A3503016341" xml:lang="en"><title>Troubleshooting |
13 Tips</title><shortdesc>This section addresses the basic differences in the way things |
13 Tips</title><shortdesc>This section addresses the basic differences in the way things |
14 are done in Symbian Platform and in Linux. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
14 are done in Symbian Platform and in Linux. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
15 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-10-1-12-1-1-5-1-3-1-9-1-3-1"> <title>Symbian |
15 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-12-1-13-1-1-5-1-3-1-9-1-3-1"> <title>Symbian |
16 directory structure</title> <p>In Symbian platform, project source files |
16 directory structure</title> <p>In Symbian platform, project source files |
17 are arranged based on the directory pattern shown below.</p><table id="GUID-AF9A4B8F-EC2B-4BBA-AE84-9B49F2081B4F"> |
17 are arranged based on the directory pattern shown below.</p><table id="GUID-AF9A4B8F-EC2B-4BBA-AE84-9B49F2081B4F"> |
18 <tgroup cols="2"><colspec colname="col1"/><colspec colname="col2"/> |
18 <tgroup cols="2"><colspec colname="col1"/><colspec colname="col2"/> |
19 <tbody> |
19 <tbody> |
20 <row> |
20 <row> |
92 </codeblock><p>In <codeph>xxx.c</codeph></p><codeblock xml:space="preserve">extern "C" EXPORT_C int Foo() |
92 </codeblock><p>In <codeph>xxx.c</codeph></p><codeblock xml:space="preserve">extern "C" EXPORT_C int Foo() |
93 { |
93 { |
94 return something; |
94 return something; |
95 } |
95 } |
96 </codeblock> </section> |
96 </codeblock> </section> |
97 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-10-1-12-1-1-5-1-3-1-9-1-3-3"> <title><codeph>dlsym()</codeph> or <codeph>g_module_symbol()</codeph></title> |
97 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-12-1-13-1-1-5-1-3-1-9-1-3-3"> <title><codeph>dlsym()</codeph> or <codeph>g_module_symbol()</codeph></title> |
98 <p>Since DLL entry points are not exported by name, DLL symbol lookup |
98 <p>Since DLL entry points are not exported by name, DLL symbol lookup |
99 functions do not work on Symbian platform. For more information about alternatives |
99 functions do not work on Symbian platform. For more information about alternatives |
100 suggested on Symbian platform, see <xref href="GUID-9D278187-8B5E-581D-9869-EE8861048F93.dita">Dynamic |
100 suggested on Symbian platform, see <xref href="GUID-9D278187-8B5E-581D-9869-EE8861048F93.dita">Dynamic |
101 Link Libraries</xref>.</p><p>The functions <codeph>dlsym()</codeph> from <codeph>libdl</codeph> and <codeph>g_module_symbol()</codeph> from GLib are examples of such functions. Look for usage of these functions |
101 Link Libraries</xref>.</p><p>The functions <codeph>dlsym()</codeph> from <codeph>libdl</codeph> and <codeph>g_module_symbol()</codeph> from GLib are examples of such functions. Look for usage of these functions |
102 in the OSS port and change the code.</p><codeblock xml:space="preserve">ret = g_module_symbol (module, "jinit_c_prep_controller", &ptr); |
102 in the OSS port and change the code.</p><codeblock xml:space="preserve">ret = g_module_symbol (module, "jinit_c_prep_controller", &ptr); |
103 </codeblock><p>needs to be changed to:</p><codeblock xml:space="preserve">ret = g_module_symbol (module, "9", &ptr);</codeblock><p>For |
103 </codeblock><p>needs to be changed to:</p><codeblock xml:space="preserve">ret = g_module_symbol (module, "9", &ptr);</codeblock><p>For |
104 example, for <codeph>dlsym()</codeph> pass the function's ordinal number as |
104 example, for <codeph>dlsym()</codeph> pass the function's ordinal number as |
105 symbol parameter (refer the library's list of exports, the DEF file for the |
105 symbol parameter (refer the library's list of exports, the DEF file for the |
106 function's ordinal number):</p><codeblock xml:space="preserve">dlsym(&handle, "foo") |
106 function's ordinal number):</p><codeblock xml:space="preserve">dlsym(&handle, "foo") |
107 </codeblock><p>needs to be changed to:</p><codeblock xml:space="preserve">dlsym (&handle, "3")</codeblock></section> |
107 </codeblock><p>needs to be changed to:</p><codeblock xml:space="preserve">dlsym (&handle, "3")</codeblock></section> |
108 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-10-1-12-1-1-5-1-3-1-9-1-3-4"><title>Problem with |
108 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-12-1-13-1-1-5-1-3-1-9-1-3-4"><title>Problem with |
109 a variable list of arguments in macros</title><p>This section suggests a way |
109 a variable list of arguments in macros</title><p>This section suggests a way |
110 to overcome the problems faced when macros with a variable list of arguments |
110 to overcome the problems faced when macros with a variable list of arguments |
111 are used.</p><codeblock xml:space="preserve">#define DEBUG(a,...)</codeblock><p>The above statement |
111 are used.</p><codeblock xml:space="preserve">#define DEBUG(a,...)</codeblock><p>The above statement |
112 causes a compilation error. One of the solutions to solve this problem is |
112 causes a compilation error. One of the solutions to solve this problem is |
113 as follows:</p><codeblock xml:space="preserve">#define DEBUG _DEBUG |
113 as follows:</p><codeblock xml:space="preserve">#define DEBUG _DEBUG |
114 static inline void _DEBUG (const char *a, ...) |
114 static inline void _DEBUG (const char *a, ...) |
115 { |
115 { |
116 }</codeblock> </section> |
116 }</codeblock> </section> |
117 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-10-1-12-1-1-5-1-3-1-9-1-3-5"> <title>Keep |
117 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-12-1-13-1-1-5-1-3-1-9-1-3-5"> <title>Keep |
118 changes to OSS to a minimum</title><p>While porting the OSS code, keep the |
118 changes to OSS to a minimum</title><p>While porting the OSS code, keep the |
119 changes to the OSS code as few as possible. The OSS code is already tested |
119 changes to the OSS code as few as possible. The OSS code is already tested |
120 and used by a bigger community, and is unlikely to have any compilation errors |
120 and used by a bigger community, and is unlikely to have any compilation errors |
121 or major logical errors. In many cases code changes that are necessary brings |
121 or major logical errors. In many cases code changes that are necessary brings |
122 potential logical flaws to the OSS port. Minimum changes to the OSS code while |
122 potential logical flaws to the OSS port. Minimum changes to the OSS code while |
123 porting also helps in merging to the new OSS. </p> </section> |
123 porting also helps in merging to the new OSS. </p> </section> |
124 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-10-1-12-1-1-5-1-3-1-9-1-3-6"> <title>Exporting |
124 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-12-1-13-1-1-5-1-3-1-9-1-3-6"> <title>Exporting |
125 variables from a DLL</title> <p>Exporting data from a DLL is not allowed |
125 variables from a DLL</title> <p>Exporting data from a DLL is not allowed |
126 in Symbian platform . The following pattern can be used:</p><ol> |
126 in Symbian platform . The following pattern can be used:</p><ol> |
127 <li id="GUID-FE2ACA35-3472-47C2-8C3F-B65CAEE09C66"><p>Do not export global |
127 <li id="GUID-FE2ACA35-3472-47C2-8C3F-B65CAEE09C66"><p>Do not export global |
128 variables. Within DLL, there is one global variable, for example:</p><codeblock xml:space="preserve">int globalVal; </codeblock></li> |
128 variables. Within DLL, there is one global variable, for example:</p><codeblock xml:space="preserve">int globalVal; </codeblock></li> |
129 <li id="GUID-F6A52B57-7E83-4DFE-9FD3-AB8E7D9B55D4"><p> Export one method |
129 <li id="GUID-F6A52B57-7E83-4DFE-9FD3-AB8E7D9B55D4"><p> Export one method |
138 extern "C" |
138 extern "C" |
139 #endif |
139 #endif |
140 IMPORT_C int* GlbData (); |
140 IMPORT_C int* GlbData (); |
141 #define globalVal (*GlbData())</codeblock></li> |
141 #define globalVal (*GlbData())</codeblock></li> |
142 </ol> </section> |
142 </ol> </section> |
143 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-10-1-12-1-1-5-1-3-1-9-1-3-7"> <title>Application |
143 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-12-1-13-1-1-5-1-3-1-9-1-3-7"> <title>Application |
144 is not loaded</title> <p>The absence of the dependent libraries could |
144 is not loaded</title> <p>The absence of the dependent libraries could |
145 be one of the reasons for the application not to load in the mobile device. |
145 be one of the reasons for the application not to load in the mobile device. |
146 On the target device, Symbian platform looks for libraries in <filepath>c:\sys\bin</filepath> or |
146 On the target device, Symbian platform looks for libraries in <filepath>c:\sys\bin</filepath> or |
147 in <filepath>z:\sys\bin</filepath>.</p><p>Do make sure that all the libraries |
147 in <filepath>z:\sys\bin</filepath>.</p><p>Do make sure that all the libraries |
148 are present in either of the above-mentioned libraries. </p> </section> |
148 are present in either of the above-mentioned libraries. </p> </section> |
149 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-10-1-12-1-1-5-1-3-1-9-1-3-8"> <title>Capabilities |
149 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-12-1-13-1-1-5-1-3-1-9-1-3-8"> <title>Capabilities |
150 not known</title> <p>Capabilities are specified in the MMP file. The |
150 not known</title> <p>Capabilities are specified in the MMP file. The |
151 primary information source is the P.I.P.S. API reference documentation. If |
151 primary information source is the P.I.P.S. API reference documentation. If |
152 problems with capabilities remain, one known method to find the capability |
152 problems with capabilities remain, one known method to find the capability |
153 is to analyze the [Debug Messages] window in CodeWarrior IDE (while debugging). |
153 is to analyze the [Debug Messages] window in CodeWarrior IDE (while debugging). |
154 During development, <codeph>CAPABILITY All –Tcb</codeph> is acceptable, but |
154 During development, <codeph>CAPABILITY All –Tcb</codeph> is acceptable, but |
155 for release code it is good practice to give a valid capability in the MMP |
155 for release code it is good practice to give a valid capability in the MMP |
156 file in order to have the application successfully signed. The following is |
156 file in order to have the application successfully signed. The following is |
157 a sample of a capability error found in the [Debug Messages] window. </p><codeblock xml:space="preserve">*PlatSec* ERROR - Capability check failed - Process hellogst.exe[10015942]0001 was checked by Thread c32exe.exe[101f7989]0001::ESock_IP and was found to be missing the capabilities: NetworkServices. </codeblock> </section> |
157 a sample of a capability error found in the [Debug Messages] window. </p><codeblock xml:space="preserve">*PlatSec* ERROR - Capability check failed - Process hellogst.exe[10015942]0001 was checked by Thread c32exe.exe[101f7989]0001::ESock_IP and was found to be missing the capabilities: NetworkServices. </codeblock> </section> |
158 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-10-1-12-1-1-5-1-3-1-9-1-3-9"> <title>Environment |
158 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-12-1-13-1-1-5-1-3-1-9-1-3-9"> <title>Environment |
159 variables</title> <p>At the moment, environment variables are not completely |
159 variables</title> <p>At the moment, environment variables are not completely |
160 supported in Symbian C++. Therefore be wary of using library functions like <codeph>getenv()</codeph> which |
160 supported in Symbian C++. Therefore be wary of using library functions like <codeph>getenv()</codeph> which |
161 work on environment variables. Make sure the library initialization routine |
161 work on environment variables. Make sure the library initialization routine |
162 calls <codeph>setenv()</codeph> with the proper value of the environment variable. |
162 calls <codeph>setenv()</codeph> with the proper value of the environment variable. |
163 Also, be wary of functions like <codeph>g_get_home_dir()</codeph> which may |
163 Also, be wary of functions like <codeph>g_get_home_dir()</codeph> which may |
164 not work as they behave in Linux.</p><codeblock xml:space="preserve">if ((memenv = getenv("JPEGMEM")) != NULL) // will not work properly</codeblock><p>Suggested |
164 not work as they behave in Linux.</p><codeblock xml:space="preserve">if ((memenv = getenv("JPEGMEM")) != NULL) // will not work properly</codeblock><p>Suggested |
165 change: </p><codeblock xml:space="preserve">void LibraryInit() |
165 change: </p><codeblock xml:space="preserve">void LibraryInit() |
166 { |
166 { |
167 setenv ("JPEGMEM ", "XXXXX", 1); |
167 setenv ("JPEGMEM ", "XXXXX", 1); |
168 }</codeblock> </section> |
168 }</codeblock> </section> |
169 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-10-1-12-1-1-5-1-3-1-9-1-3-10"> <title>Assembly |
169 <section id="GUID-77D7347D-8DEC-45D0-A677-8FDBDFB8FF81-GENID-1-12-1-13-1-1-5-1-3-1-9-1-3-10"> <title>Assembly |
170 code</title> <p>The syntax for inline assembly code is different in |
170 code</title> <p>The syntax for inline assembly code is different in |
171 Symbian platform. The following is a code snippet of assembly code syntax |
171 Symbian platform. The following is a code snippet of assembly code syntax |
172 in Symbian platform.</p><codeblock xml:space="preserve">EXPORT_C __NAKED__ TUint16 TTemplate::Register16(TUint anAddr) |
172 in Symbian platform.</p><codeblock xml:space="preserve">EXPORT_C __NAKED__ TUint16 TTemplate::Register16(TUint anAddr) |
173 /** |
173 /** |
174 Read a 16-bit register |
174 Read a 16-bit register |