David S. Anderson

Please bare with me as its been a very long time since I have even looked at Native code, and I don't remember much of anything from those days.

I have a Win32 DLL Project. In this project I have a class with some functions. This class is nested under 3 namespaces. It looks like this:

// NTSHOST.H
// .
// .
// .
namespace DCOM Productions {
namespace InteractiveTeamSystem {
namespace TeamServer {
class __declspec(dllexport) SERVER
{
public:
SERVER(void);

static void Initialize()
{
// ... Initialization code
}
}
}
}
}

// NTSHOST.CPP
// .
// .
// .
SERVER:Tongue TiedERVER()
{
return;
}

Now what I want to do is export my Initialize function, and other functions I implement like such. The next step I would like to be able to accomplish is to just reference the DLL into my CLR Console Application (which references fine, this isn't a problem). The problem is that my namespaces do not export. So I cannot do:

using namespace DCOMProductions::InteractiveTeamSystem::TeamServer;
// .
// .
// .

So my questions are as follows:
1. How do I "export" my namespaces (If I need to)
2. How do I "export" my Initialize() method (If I need to) and call on it from my CLR Console Application

Take into consideration:
* My Native DLL compiles
* My Native DLL is referenced in my CLR Console Application just fine
* However, my namespaces do not "exist" to the CLR program.
* However, my class does not "exist" to the CLR program.
* etc.

Thank you in advance if you decided to shed some light and help me out here. I greatly appreciate it. I hope I have provided enough information.



Re: Visual C++ General Native DLL, Managed/CLI Console.

Shakje

I was pretty sure that you couldn't just reference in a native DLL unless it's COM. You might have to take the namespaces out and just use import. I'm still not 100% sure on this but maybe this will help:

http://blogs.msdn.com/deeptanshuv/archive/2005/06/26/432870.aspx






Re: Visual C++ General Native DLL, Managed/CLI Console.

Ramkrishna Pawar

Even though the class was inside namespace, it gets exported. I think linking to that DLL and using the same class header file (which has the namespace and all) will solve the problem.




Re: Visual C++ General Native DLL, Managed/CLI Console.

Ðãv? S. Â???????

I made a video to show what my problem is. It shows everything I want to do, and how I want to do it, as well it isn't working. Note that in this video there are no namespaces. Though the same problem would persist when trying to include a namespace.

http://www.dcomproductions.net/nativedll/nativedll.html





Re: Visual C++ General Native DLL, Managed/CLI Console.

Ðãv? S. Â???????

I have also tried to use the DllImport attribute. However, when I call on the function it throws an error stating that the EntryPoint was not found.





Re: Visual C++ General Native DLL, Managed/CLI Console.

ChopperDavo

I dunno about exporting the namespaces, but why don't you try writing a little test native app to call the dll. What I mean is, create a Win32 app in a separate (or the same, shouldn't matter) project and call your dll functions.

This will tell you if your entry points are ok etc. And that you are exporting correctly.

Then maybe move on to the CLR app and see how you go. I have a feeling that the exported function address will be calculated and exported, regardless of whether it's in a namespace, class etc.






Re: Visual C++ General Native DLL, Managed/CLI Console.

Ðãv? S. Â???????

Edit: I've decided not to do interop, so im going full native and now its working fine. Thanks guys.