Symbian xLoader 1.0 Introduction
xLoader is a static library for Symbian platform, which enables symbian applications to load dynamic-link libraries (DLL) under any directory. DLLs loaded by xLoader are free of "Symbian Sign". DLLs loaded by xLoader don't need UID and capability set.
If your Symbian application need upgrade regularly, by encapsulating functionalities, algorithms and plug-ins into external DLLs (external DLL: DLL loaded by xLoader), xLoader can save your money and time.
xLoader supports all Symbian platforms since S60 3rd, including: S60 3rd, S60 3rd FP1, S60 3rd FP2, S60 5th and Symbian^3.
An external DLL can call Symbian system APIs directly, and functions provided by other regular DLLs under "sys\bin" - as simple as you do in regular Symbian DLL. An external DLL can also load other external DLLs.
An external DLL has same capabilities as the process which loads this DLL. For example: if process "ProcFoo" has NetworkControl capability, after it loads external DLL "DllBar" by xLoader, "DllBar" can also have NetworkControl capability. In the other side, if "ProcFoo" doesn't have NetworkControl capability, calling Symbian APIs which needs this capability in "DllBar" will cause security error.
In external DLL, const static variables (global or class member) are supported. An external DLL can export:
1. non-member function (function which is not a member of a class)
2. static member function
3. const static variable
4. C function (function with extern "C" declaration)
To load an external DLL, you need create a CXLoader object, and then call LookupL to get the function pointer exported by the DLL.
Let's have a small plug-in application as demonstration. Firstly, we define a c++ interface MPlugin:
Then we create a new DLL project: TestPlugin, and implement a sub-class of MPlugin: CTestPlugin. CTestPlugin::NewL need be declared by EXPORT_C.
virtual void Foo() = 0;
virtual void Bar() = 0;
Now we can create a new project "Demo" to load this DLL.
class CTestPlugin : public CBase, public MPlugin
// exported constructure
IMPORT_C static CTestPlugin* NewL();
virtual void Foo();
virtual void Bar();
// constructor, destructor
// other functions, variables, etc
1. Add new members in DemoAppUi:
2. Load the DLL and create a new CTestPlugin object:
// private member
3. Compile these two projects, copy "TestPlugin.dll" to "c:\data\", and then the demo application could be run.
// assume the DLL will put in c:\data - though we suggest you put your DLL
// under the private folder of your application
// use xLoader to load the external DLL
iLoader = CXLoader::NewL(dllName());
// define the sequence number of DLL's exported functions
// As we have only one exported function defined in the DLL, its sequence
// number must be 1 in the DEF file (sequence is started from 1). However, in
// xLoader, a function's index is started from 0 (sequence - 1).
// You can directly call LookupL with index 0, but giving it a readable name
// is suggested.
// 1. get function pointer of CTestPlugin::NewL by LookupL
// 2. create a new CTestPlugin instance
typedef MPlugin* (*pfCreatePlugin)();
pfCreatePlugin fCreatePlugin = (pfCreatePlugin)iLoader->LookupL(Index_CreatePlugin);
iPlugin = fCreatePlugin();
// call functions implemented in the DLL
xLoader provides two files to application developer:
1. xLoader.lib - xLoader static library
2. xLoader.h - header file which includes the declaration of class CXLoader
You need add "xLoader.lib" in your project (add "STATICLIBRARY xLoader.lib" in your MMP file), and:
1. add "ReadUserData" capability for you application
2. add "efile.lib" and "efsrv.lib" in your project also
xLoader is not for free, please contact us if you want to use it.