Currently I’m developing a DLL which is intended to be linked to 3rd party applications in order to test whether this application is eligible to run at a given time.
First I thought about to create a DLL and handle the needed check in TInt E32Dll() function. But I was very surprised when I’ve read that this function is not called on DLL load/unload in EKA2.
So now I need another way to achieve my task. My goal is to create some mechanism, which can be embedded in 3rd party applications. This mechanism should be called on application start, perform some check (presence of specific Symbian server), and if the check is failed, it should terminate the application. Another requirement is that this mechanism should be transparent at best to developers of those 3rd party applications. (The E32Dll() function was the best candidate – just link specific library to a project and you’re done…)
I’ll greatly appreciate any other ideas. Thanks in advance.
I am not sure that doing something in E32Dll() even it work (but it doesn’t as you figure out) is a good way, because prior to closing the application you have to show some notification or dialog to the user. Why not making a normal DLL + thin start-up code, which will load (using the RLibrary) and call the 1st ordinal function:
BR
STeN
Hi Haspemulator, There is my answer to your comment:
1) No, the 1st ordinal is not E32Dll(), this method cannot be called since EKA2. Check the description below (http://developer.symbian.org/wiki/Symbian_OS_Internals/10._The_Loader):
Note that, in EKA2, the public DLL entry-point, E32Dll(TDllReason) is no longer invoked. This function must be present in every EKA1 DLL, to be called when the DLL is attached to or detached from a process or thread. Unfortunately, this entry-point system cannot provide any guarantees that E32Dll() will be called with the appropriate parameter at the specified time. Because it is not possible to support this functionality reliably, EKA2 removes support for it. This removal simplifies the kernel-side architecture for managing dynamically loaded code, which improves reliability and robustness.
2) You can find an interesting discussion regarding this topic also here:
http://discussion.forum.nokia.com/forum/showthread.php?80781-What-is-the-replacement-for-E32Dll-and-TDllReason
3) In our case the 1st ordinal will be the 1st function you will export from the DLL. You can find information how to write such a DLL here:
http://developer.symbian.org/main/documentation/reference/s3/pdk/GUID-4A56B285-790E-5171-88F3-8C40B2AA9699.html
4) To be more concrete what I mean by exporting a method from DLL check the code below (the method can of course return some variable – e.g. newly created object):
Hope it helps…
BR
STeN