Here is my call in C
cli::array<mercurial::fileItem>^ tmp = mercFlowCLR::merc::getFolderList(gcnew System::String(remotePath));
Here is my C# Structure:
public struct fileItem
{
public string fileName;
public bool isFolder;
}
My getFolderList is returning of type in C#: List<mercurial::fileItem>
The C++ DLL is wrapping the C# DLL. I have C calling the C# routines, and both the C# and C++ Project are DLLS. How do I work with fileName and isFolder in the C Code?
Update: I changed the type as Ben Voigt suggested to get:
System::Collections::Generic::List<mercurial::fileItem>^ tmp = mercFlowCLR::merc::getFolderList(gcnew System::String(remotePath));
That then allowed me to use tmp[0]->
and see my structure fields isFolder and fileName.
When I tried to compile I then got a set of three or four almost the same errors for the line above:
Error 7 error C2526: 'System::Collections::Generic::IList<T>::default::get' : C linkage function cannot return C++ class 'mercFlowCLR::mercurial::fileItem' y:\merc-flow\mercFlowCLRWrapper\mercFlowCLRWrapper.cpp 102 mercFlowCLRWrapper
So I then created another function that wasn't using extern "C" __declspec(dllexport)
and tested the same code, and it compiled. I am going to try to proxy the request through the C++ function and see if it works. I was using the extern "C" with a function including the getFolderList call.
Update 2: The above worked. Thanks for the help Kate & Ben.