C# program can't find namespace of classes in C++ dll

Discussion in 'ASP .Net' started by Beck Johnson via .NET 247, Mar 7, 2005.

  1. I'm using unmanaged C++ libraries that I have created managedwrapper classes for. I would like to use these wrapped classesin a C# program, but I have run into a problem.

    Although I have both put a "using" statement at the top of theprogram AND included the dll as a reference, I get the followingerror message when trying to use those classes: "The type ornamespace name "NameOfClass" could not be found (are you missinga using directive or an assembly reference?)

    I've even moved the location of the .dll file around, thinkingmaybe it had to be in a specific directory to be found (someposts suggested that it had to be in the /bin directory of theproject). That didn't work. I've also rewritten the wrapperclasses without a namespace, thinking that might illuminate theproblem.

    Code as follows:

    -----------------------------------------------
    The managed wrapper for one of the unmanaged C++
    classes, which are contained in dicomlib.lib.
    This class is compiled into a .dll file called
    "managedDicomlib.dll"
    -----------------------------------------------

    #using "dicomlib.lib"
    #using <mscorlib.dll>

    using namespace System;

    //namespace managedDicomlib {

    public __gc class AAssociateRQ {
    private:
    dicom::primitive::AAssociateRQ* pAAssociateRQ;
    public:
    AAssociateRQ() { pAAssociateRQ = newdicom::primitive::AAssociateRQ(); }
    AAssociateRQ( string& CallingAp, string& CalledAp ) {
    pAAssociateRQ = new dicom::primitive::AAssociateRQ( CallingAP,CalledAp );
    }

    ~AAssociateRQ() { delete pAAssociateRQ; }
    };
    //}


    -----------------------------------------------
    The C# class which uses the wrapped C++ class
    -----------------------------------------------

    using System;
    using managedDicomlib;


    namespace usingManagedDicomlib {

    public class Driver {

    void Main( string[] args ) {
    AAssociateRQ aarq = new AAssociateRQ();

    }
    }
    }


    Could someone tell me if something in my .dll is changing what Ithink is the namespace? Or if my problem is something else? Thank you in advance.

    --------------------------------
    From: Beck Johnson

    -----------------------
    Posted by a user from .NET 247 (http://www.dotnet247.com/)

    <Id>/vi1/698PUqz/0uQ9ad72A==</Id>
     
    Beck Johnson via .NET 247, Mar 7, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anushi
    Replies:
    5
    Views:
    8,944
  2. Èý¹â
    Replies:
    1
    Views:
    592
    William F. Robertson, Jr.
    Jul 29, 2003
  3. Peng Yu
    Replies:
    0
    Views:
    659
    Peng Yu
    Sep 14, 2008
  4. ThunderMusic
    Replies:
    1
    Views:
    163
    ThunderMusic
    Feb 22, 2007
  5. H. Simpson
    Replies:
    4
    Views:
    328
    H. Simpson
    Aug 3, 2004
Loading...

Share This Page