03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

};<br />

}<br />

};<br />

}<br />

version_no = 1;<br />

display_name = "Loopback";<br />

default_data = "";<br />

opaque_data = "0";<br />

Let's go through this step by step:<br />

� The resource file is named after the DLL 3rd UID – 101F8B54.rss. This is a<br />

requirement of the ECOM framework. If the two don't match, then my DLL will not be<br />

loaded.<br />

� I include RegistryInfo.rh as this defines the resource structures ECOM depends<br />

on.<br />

� I declare a REGISTRY_INFO structure to describe the DLL.<br />

� Its first entry is dll_uid, which I set to the GDPLOOP.DLL 3rd UID.<br />

� Its second entry is interfaces, which I set to an array of INTER-FACE_INFO<br />

resources.<br />

� Each INTERFACE_INFO resource defines the registration information for the interface.<br />

I set the interface_uid to the GDP interface UID, 0x101F8B52.<br />

� The implementations member is set to an array of IMPLEMENTATION_INFO<br />

structs.<br />

� I set the implementation_uid to the UID of the loopback implementation, and set<br />

the version_no, display_name, default_data and opaque_data fields<br />

appropriately.<br />

The result is a resource file that describes this DLL as having one implementation of the<br />

GDP interface.<br />

When ECOM loads a DLL in response to a request, it needs to be able to create the right<br />

implementation. The key to this is the Implementa tionGroupProxy() function in<br />

gdploop.cpp:<br />

const TImplementationProxy ImplementationTable[] =<br />

{<br />

{{0x101f8b53}, CGdpLoopback::NewL},<br />

};<br />

EXPORT_C const TImplementationProxy* ImplementationGroupProxy<br />

(TInt& aTableCount)<br />

{<br />

aTableCount = sizeof(ImplementationTable) /<br />

sizeof(TImplementationProxy);<br />

return ImplementationTable;<br />

}

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

Saved successfully!

Ooh no, something went wrong!