Reputation: 1092
Let's assume the following situation:
class A
{
public:
void MyMethod()
{
a->AnotherMethod(b);
}
private:
MyType* a;
MyAnotherType* b;
};
and
typedef std::vector< int >MyAnotherType;
I want to pass a pointer to std::vector allocated (and filled in) in C++/CLI code to unmanaged C++. If I simply write a->AnotherMethod(b)
then the vector is empty in unmanaged code (e.g. 4 elements in C++/CLI and 0 elements after passing to a
.
What is the proper way to do that?
Upvotes: 1
Views: 1377
Reputation: 17272
Try pragma managed and unmanaged.
Make sure the definition of the class you are passing into the DLL is defined in unmanaged section.
Upvotes: 1