简体   繁体   中英

Importing singed C# dll into C++ project?

I'm trying to import .net dll into C++ project. c++ code constains following code:

#include "stdafx.h"
#import "RemoteAgentLibs.tlb" named_guids raw_interfaces_only
int main() {
    HRESULT init = CoInitialize( NULL );
    if (init != S_OK) return 1;

    ImportedNamespace::_ClassNamePtr myclass;
    myclass = new ImportedNamespace::_ClassNamePtr("ImportedNamespace.ClassName");
    myclass->MyMeyhod();
}

Everything works fine untill I check the "Sign the assembly" in properties of my .NET project. In .NET project I get warning:

Warning 3 "path to dll" does not contain any types that can be unregistered for COM Interop.

Warning 3 "path to dll" does not contain any types that can be registered for COM Interop.

In C++ project I get error:

error C2039: 'MyMethod' : is not a member of 'ImportedNamespace::_ClassNamePtr'

Could somebody tell me why there is a problme with importing strong name signed dlls? or is there any other way to import my dll into c++ project and add dll to GAC

Did you look SWIG ? I think it's a good solution you just have to write a wrapper for your need...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM