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

  • Thread starter Beck Johnson via .NET 247
  • Start date
B

Beck Johnson via .NET 247

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top