kerneltest/e32test/misc/t_destruct_dll.cpp
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32test\misc\t_destruct.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32debug.h>
       
    19 #include <e32msgqueue.h>
       
    20 #include "t_destruct.h"
       
    21 
       
    22 class TTestObjectStatic
       
    23 	{
       
    24 public:
       
    25 	TTestObjectStatic();
       
    26 	~TTestObjectStatic();
       
    27 	};
       
    28 
       
    29 TTestObjectStatic GlobalObjectWithDestructor;
       
    30 
       
    31 void Panic(TInt aReason)
       
    32 	{
       
    33 	User::Panic(_L("t_destruct_dll"), aReason);
       
    34 	}
       
    35 
       
    36 TTestObjectStatic::TTestObjectStatic()
       
    37 	{
       
    38 	RDebug::Printf("t_destruct_dll constructor called\n");
       
    39 	TInt r;
       
    40 	RMsgQueue<TMessage> messageQueue;
       
    41 	r = messageQueue.OpenGlobal(KMessageQueueName);
       
    42 	if (r != KErrNone)
       
    43 		Panic(r);
       
    44 	r = messageQueue.Send(EMessageConstructStatic);
       
    45 	if (r != KErrNone)
       
    46 		Panic(r);
       
    47 	messageQueue.Close();
       
    48 	}
       
    49 
       
    50 TTestObjectStatic::~TTestObjectStatic()
       
    51 	{
       
    52 	RDebug::Printf("t_destruct_dll destructor called\n");
       
    53 	TInt r;
       
    54 	RMsgQueue<TMessage> messageQueue;
       
    55 	r = messageQueue.OpenGlobal(KMessageQueueName);
       
    56 	if (r != KErrNone)
       
    57 		Panic(r);
       
    58 	r = messageQueue.Send(EMessageDestructStatic);
       
    59 	if (r != KErrNone)
       
    60 		Panic(r);
       
    61 	messageQueue.Close();
       
    62 	}
       
    63 
       
    64 EXPORT_C void StaticMain()
       
    65 	{
       
    66 	StaticMain3();
       
    67 	}