03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The GSDP server presented here has its own specific task to perform, but in many ways it's<br />

typical, and I'll describe it in sufficient detail here so that you can use it with confidence as a<br />

basis for implementing your own servers.<br />

19.1 Software Structure<br />

You can find the source code for the GSDP server and its client interface in \scmp\gsdp\.<br />

Here's the structure of the server and its interfaces in Figure 19.1:<br />

Figure 19.1<br />

The server and its client interface are delivered in a single DLL, gsdp.dll. The client<br />

interface consists of a header file, gsdp.h, which we'll look at shortly, and corresponding<br />

functions exported from the DLL. Another header file, gsdpdef.h, includes definitions that<br />

tie the client interface and the server together – mainly the request codes passed in the<br />

various messages. All other header files are private either to the client alone or to the server<br />

alone.<br />

The GSDP server is a transient server: it's started when a client needs it, and terminates<br />

itself when no more clients need it. The startup code launches the server as a new thread<br />

under the WINS emulator, or as a new process on target machines. The startup code for the<br />

emulator is also contained in gsdp.dll; for MARM, it's a separate, very small, .exe.<br />

This design minimizes the differences between the two platforms. It follows the design of the<br />

Symbian OS DBMS server, which was written for Symbian OS v5. Among the useful aspects<br />

of this single-DLL design are that it eases debugging under the emulator because there's<br />

only a single project, and it ensures that client and server code are in sync because they're<br />

delivered in the same DLL.<br />

Many Symbian OS servers use a separate DLL for the client interface, and a relatively large<br />

program for the server, delivered as a .exe for target machines, and a DLL for the emulator.<br />

Note<br />

One reason that may compel server authors to use a .exe is if they cannot<br />

do anything to eliminate writable static data in the server code, perhaps<br />

because they are porting code.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!