Let me start by stating that I am not a C++ developer. I have started learning (books, tutorials, etc.), but I am only beginning, so please explain like I'm 5.
I have a C# DLL that I am using in a C++ project. I have access to the namespace and all of the classes contained in the DLL, and already have working code that is making use of it.
Unfortunately, there is a method that I do not know how to use from C++.
The C# DLL has a namespace (CeeSharpNamespace) and a class (CeeSharpClass) which has a method:
public bool UseThisList(List<AnotherCeeSharpClass> theList)
What I am trying to figure out is how to call this method from C++.
I have an instance of type CeeSharpClass:
CeeSharpNamespace::CeeSharpClass ^workerClass;
and I created a "list" in C++:
std::vector<AnotherCeeSharpClass>* dataList;
which then gets populated with data in the C++ code.
Then I started writing the call, but quickly realized my problem:
bool result = workerClass-> UseThisList(???);
C++ does not have a "List<>" that I am aware of, and C# won't recognize "std::vector" (or if it would, I do not know how to do it)—how do I make use of this method?
EDIT:
So, this is frustrating. I'm not sure why this was closed, as the referenced "duplicate" does nothing to answer my question as far as I can tell.
I'm not sure why people assume that I have access to modify the C# DLL, I never claimed to. I have a C# DLL that I want to call. It is what it is. My only other option is to stop having the C# DLL and write my own C++ code to replace the functionality. (This is not the desired option.)
I can already use the DLL from my C++ code, I have a class (.cpp and .h) in C++ that interacts with the DLL already.
My question was about the incompatible data types. The C# method that I would like to use takes a List<> as a parameter, but I do not have a List<> in C++ land, I have std::vector. How do I resolve this?
EDIT #2:
Thank you to everyone who took the time to read and leave a comment.
So, I think that I may have found the answer to my problem, I just need to test it. Visual Studio/IntelliSense reported that the expected parameter datatype was:
System::Collections::Generic::List<AnotherCeeSharpClass^>^ dataList
This has certainly eliminated the errors that Visual Studio was reporting. I'll update when I am finished coding/testing.
EDIT #3: Yes, this was exactly what I needed. It works like a charm. Thanks again to those who shared their time and effort.