Karthik Agarwal

Karthik Agarwal

  • NA
  • 748
  • 266.5k

How to access a class in a namespace which is in different project?

Sep 12 2011 4:59 AM
Hi,

I have three projects under another project of which each contains one namespace. Now among them i need to call a class which is under a namespace in visual studio 2008. Please don't ask me to add the dependencies to the main project so that i can access the namespace and all the classes in that just like local namespace which i can't do due to some restrictions. Tell me something like derived class concept so that i can access that class.

The LanguageTable class which i want to call is as follows:

#pragma once

#include "resource.h"

#using <mscorlib.dll>
#using <System.dll>
#using <System.Xml.dll>
#using <System.Drawing.dll>
#using <System.Windows.Forms.dll>

using namespace System;
using namespace System::Xml;
using namespace System::ComponentModel;
using namespace System::Drawing;
using namespace System::Windows::Forms;
using namespace System::IO;
using namespace System::Collections::Generic;
using namespace System::Runtime::InteropServices;

#define GFX_LANGUAGE_MAX 20

namespace gfx_viewer_win32
{

  public ref class LanguageTable 
  {
  public:    
     static Dictionary<String ^, List<String ^>^> ^ language_string_table;
     static array<String ^> ^language_string_id;
     static StreamReader^ LanguageReader;
     static String ^ copy_of_language_path;
     static String ^ copy_of_clicked_language;
     static String ^ max_dec_string;
     static String ^ max_hex_string;
     static bool load_OK_btn = false;
 
     LanguageTable(void)
     {
        language_string_id = gcnew array<String ^>(0);
     }
     ~LanguageTable(void)
     {
        if(LanguageReader)
        {
           delete LanguageReader;
        }
        delete language_string_id;
        delete language_string_table;
     }     
  };
}


The place from where i want to call LanguageTable class is as follows:

// Code_generator.h

#pragma once

#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::Drawing::Imaging;
using namespace System::Text;
using namespace System::Xml;
using namespace System::Collections;
using namespace System::Collections::Generic;
using namespace System::IO;
using namespace System::Globalization;
using namespace System::Windows;
using namespace System::Windows::Media;
using namespace System::Windows::Media::Imaging;
using namespace gfx_coder_prj_parser;

namespace Code_generator
{
public ref class CCodeGenerator : CCodeParserMultiLayer
    {
     public:
       String ^ codegen_path;
       int l_compressed_images_present;
       CCodeGenerator(void)
       {
       }
       ~CCodeGenerator(void)
       {
       }
//============I want to call LanguageTable class from here==========
    };
}



Answers (15)