I have an Assembly(A) which defines a Managed class which has a public constructor that takes two native types.
I have access to the Header files and compiled lib files which contain the native types.
I created a C++/CLI
project and defined a ref class
which contains a single public: static
method that returns a public type defined in (A).
When I try to contstruct by passing in a native type I receive the `C3767 'YourType::TypeB': Candidate function(s) not accessible.
I've added #pragma make_public(Type)
for the native types and any type they derive from but still not joy.
My class header:
#pragma once
#include "StdAfx.h"
using namespace System;
using namespace AssemblyA;
namespace NativeWrapper {
ref class MyFactory
{
public:
static AssemblyAType^ Build();
};
}
My cpp file:
#include "StdAfx.h"
#pragma make_public(nativeObjectRoot)
#pragma make_public(nativeObjectDerived)
#include "MyFactory.h"
using namespace System;
using namespace NativeWrapper;
AssemblyAType^ MyFactory::Build()
{
nativeObjectDerived* myNativeObject;
//myNativeObject initialised and set up here
return gcnew AssemblyAType(myNativeObject); <--C3767
}
I've looked and the managed type `AssemblyAType' has a public constructor with this signature. Can't seem to get the pragma to work??
So to summarize.
My C++/CLI project references a 3rd party Assembly that defines a type which takes a native type in its constructor. My project also has the header/lib files added/linked to.
Note: my code above isn't exactly what I've got but I've stripped out the pertinent parts.