Hi,
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:
RLibrary library;
//UID
TUidType uidType( TUid::Uid(KDynamicLibraryUidValue),
TUid::Uid(KMyInterfaceUid),
TUid::Uid(KMyImplementationUid) );
// Open dll
User::LeaveIfError( library.Load( KMyDll, uidType ) );
// Check the exported method
TLibraryFunction ordinal1 = aLibrary.Lookup( 1 );
// Call the method...
if ( ordinal1 )
ordinal1();
library.Close();
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):
EXPORT_C void InitDll()
{
// Put here your code
}
Hope it helps...
BR
STeN