I'm currently working on a .NET Framework 4.7.2 application which needs to expose some methods from C++ to be able to use them later on in a .NET Standard/Core environment.
I know, I cannot expose Classes from C++ to C# using pInvoke. Furthermore I figured it's not possible to expose abstract .NET data types such as List because the implementation in C++ and C# is different.
Thus I can only use structs with fundamental data types to pass data from C# to C++.
I'm trying to find the unmanaged equivalent for this managed C++ signature:
List<KeyValuePair<int, Dictionary<System::String^, float>^>>^ tomatoes
My current C++ code looks like this:
typedef struct
{
//int arr[10];
// here I need to define a structure similiar to List<KeyValuePair<int, Dictionary<System::String^, float>^>>^ tomatoes
} TOMATO_DATA;
extern "C"
{
__declspec(dllexport) int Veggy_Create(TOMATO_DATA & data)
{
return 42;
}
}
Unfortunately it's really difficult, I don't know how to picture
List<KeyValuePair<int, Dictionary<System::String^, float>^>>^ tomatoes
as a struct data type to use it for marshaling.
Do you know how to solve this issue?
Thanks!
Comments
Post a Comment