examples/Basics/StaticDLL/CreateStaticDLL.cpp

00001 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
00002 // All rights reserved.
00003 // This component and the accompanying materials are made available
00004 // under the terms of "Eclipse Public License v1.0"
00005 // which accompanies this distribution, and is available
00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00007 //
00008 // Initial Contributors:
00009 // Nokia Corporation - initial contribution.
00010 //
00011 // Contributors:
00012 //
00013 // Description:
00014 // This program creates a dll.
00015 //
00016 
00017 #include "CreateStaticDLL.h"
00018 #include <e32uid.h>
00019 
00020 // construct/destruct
00021 
00022 EXPORT_C CMessenger* CMessenger::NewLC(CConsoleBase& aConsole, const TDesC& aString)
00023         {
00024         CMessenger* self=new (ELeave) CMessenger(aConsole);
00025         CleanupStack::PushL(self);
00026         self->ConstructL(aString);
00027         return self;
00028         }
00029 
00030 CMessenger::~CMessenger() // destruct - virtual, so no export
00031         {
00032         delete iString;
00033         }
00034 
00035 EXPORT_C void CMessenger::ShowMessage()
00036         {
00037         _LIT(KFormat1,"%S\n");
00038         iConsole.Printf(KFormat1, iString); // notify completion
00039         }
00040 
00041 // constructor support
00042 // don't export these, because used only by functions in this DLL, eg our NewLC()
00043 
00044 CMessenger::CMessenger(CConsoleBase& aConsole) // first-phase C++ constructor
00045         : iConsole(aConsole)
00046         {
00047         }
00048 
00049 void CMessenger::ConstructL(const TDesC& aString) // second-phase constructor
00050         {
00051         iString=aString.AllocL(); // copy given string into own descriptor
00052     }
00053 

Generated by  doxygen 1.6.2