Ask Dr. Dotnetsky - Create c++ dll for use in c# or vb.net application

Asked By Henry Taylor on 25-Sep-14 06:35 PM
Can some one point me to a good online article that shows how to create a dll with VS c++ code that can then be used from c#, vb.net or even Powerbuilder?  Powerbuilder is why I am doing this but I don't have it on my machine so I thought if I could get it to work with c# it might work in Powerbuilder.

I have the code written but I cannot access any of the code in the dll.

Inside my .cpp file I have

namespace PRSFuncs
{
    BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved)
    {
return TRUE;
    }

    string SendFile(string fileName)
    {
// my function stuff
    }
}

and my .h file has

namespace PRSFuncs
{
    class MyPRSFuncs
    {
    public:
        // 
        extern "C"
{
__declspec(dllexport) string SendFile(string fileName);
}
    };
}

Everything complies but in my c# test application I reference the dll but nothing I try can access anything in the dll.

Thanks.