e32tools/elf2e32/source/librarytarget.cpp
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 // Copyright (c) 2004-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 "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 // Implementation of the Class LibraryTarget for the elf2e32 tool
       
    15 // @internalComponent
       
    16 // @released
       
    17 // 
       
    18 //
       
    19 
       
    20 #include "librarytarget.h"
       
    21 #include "pl_dso_handler.h"
       
    22 #include "deffile.h"
       
    23 #include <iostream>
       
    24 
       
    25 /**
       
    26 Constructor for the Library Class
       
    27 
       
    28 @internalComponent
       
    29 @released
       
    30 */
       
    31 LibraryTarget::LibraryTarget(ParameterListInterface* aParameterListInterface):
       
    32 UseCaseBase(aParameterListInterface)
       
    33 {
       
    34 	iElfIfc = new DSOHandler(aParameterListInterface);
       
    35 	iDefFile = new DefFile();
       
    36 }
       
    37 
       
    38 
       
    39 /**
       
    40 Destructor for the Library Class
       
    41 
       
    42 @internalComponent
       
    43 @released
       
    44 */
       
    45 LibraryTarget::~LibraryTarget()
       
    46 {
       
    47 	delete iElfIfc;
       
    48 	delete iDefFile;
       
    49 }
       
    50 
       
    51 /**
       
    52 Execute Function for the library target creation. The symbols are read from the input
       
    53 DEF file. The DSO file is generated on passing the symbols.
       
    54  
       
    55 @internalComponent
       
    56 @released
       
    57 
       
    58 @return EXIT_SUCCESS, on successful creation of library.
       
    59 */
       
    60 int LibraryTarget::Execute()
       
    61 {
       
    62 	SymbolList *aSymList;
       
    63 	aSymList = ReadInputDefFile();
       
    64 	GenerateOutput(aSymList);
       
    65 	return EXIT_SUCCESS;
       
    66 
       
    67 }
       
    68 
       
    69 /**
       
    70 Function to read the symbols from the DEF file.
       
    71  
       
    72 @internalComponent
       
    73 @released
       
    74 
       
    75 @return the list of symbols read from the DEF file.
       
    76 */
       
    77 SymbolList* LibraryTarget::ReadInputDefFile()
       
    78 {
       
    79 	char * aDEFFileName = UseCaseBase::DefInput();
       
    80 
       
    81 	return iDefFile->ReadDefFile(aDEFFileName);
       
    82 }
       
    83 
       
    84 /**
       
    85 Function to generate the output DSO File.
       
    86  
       
    87 @internalComponent
       
    88 @released
       
    89 */
       
    90 void LibraryTarget::GenerateOutput(SymbolList* aSymList)
       
    91 {
       
    92 	char * aLinkAs = UseCaseBase::LinkAsDLLName();
       
    93 	char * aDSOName = UseCaseBase::DSOOutput();
       
    94 	char * aDSOFileName = UseCaseBase::FileName(aDSOName);
       
    95 
       
    96 	iElfIfc->WriteElfFile( aDSOName, aDSOFileName, aLinkAs, *aSymList);	
       
    97 }