VC++。net:未导出托管DLL中的功能 我对.NET平台(来自JVM和有限的C/C++体验)非常陌生,尝试我的第一个托管C++类库。这是作为一个桥梁到第三方DLL我得到,我必须接口。我用BridJ和Java试过了,但到目前为止没有成功,所以我现在正在尝试编写一个程序,它使用C#中的第三方DLL 第三方DLL是非托管C++。

VC++。net:未导出托管DLL中的功能 我对.NET平台(来自JVM和有限的C/C++体验)非常陌生,尝试我的第一个托管C++类库。这是作为一个桥梁到第三方DLL我得到,我必须接口。我用BridJ和Java试过了,但到目前为止没有成功,所以我现在正在尝试编写一个程序,它使用C#中的第三方DLL 第三方DLL是非托管C++。,c#,c++,visual-c++,dll,C#,C++,Visual C++,Dll,到目前为止,我的ManagedBridge.h与此类似: #pragma once #include "thirdparty.h" using namespace System; namespace ManagedBridge { class __declspec(dllexport) BridgedThirdPartyThing { private: THIRDPARTYNS::ThirdPartyThing* _delegate; publ

到目前为止,我的
ManagedBridge.h
与此类似:

#pragma once

#include "thirdparty.h"

using namespace System;

namespace ManagedBridge {

    class __declspec(dllexport) BridgedThirdPartyThing {

    private:
        THIRDPARTYNS::ThirdPartyThing* _delegate;

    public:
        BridgedThirdPartyThing();

        ~BridgedThirdPartyThing();

        void foo();

        // more methods
    };
}
到目前为止,我的
ManagedBridge.cpp
如下所示:

#include "stdafx.h"
#include "ManagedBridge.h"

namespace ManagedBridge {

    BridgedThirdPartyThing::BridgedThirdPartyThing() {
        _delegate = new THIRDPARTYNS::ThirdPartyThing();
    }

    BridgedThirdPartyThing::~BridgedThirdPartyThing() {
        delete _delegate;
    }

    void BridgedThirdPartyThing::foo() {
        _delegate -> foo();
    }

    // similar for the other methods
}
}

现在,当我构建它时,不会出现任何错误,并且会创建一个
ManagedBridge.dll

然后,我创建了一个C#控制台应用程序来测试我的DLL,并将其添加为引用,但我无法访问使用
\uuu declspec(dllexport)
导出的类。对象浏览器中仅显示名称空间

我错过了什么?

public ref class BridgedThirdPartyThing
对于C++/CLI。您不使用u declspec(dllexport)。请注意,该类必须是公共的,才能对消费程序集可见