S
Subodh
Hi All,
I want to use a C++ API in a static lib that returns a linked List in
C#
I am planning to P/Invoke to perform the Interop, I would like to know
which way will be better to interop a Linked list to C# in terms of
performance, I have came across following methods
I am creating a flat DLL to export the static lib functionality.
1. From the C++ DLL write the linked list structures in an xml file
and pass the path of the file to C# app which will
read data from this file
2. Use callback function
-pass a pointer to C# function(delegate) from C# to the exported C++
DLL function
-in the C++ DLL perform callback to this C# function with a pointer to
structure, for each structure in the linked list
-The C# callback function will then marshal the structure using
"PtrToStructure" and put this in required collection
----> With this approach i am worried about performancee if the linked
list contains thousands of nodes
3. Creating a Vector of structure from Linked list in C++ DLL and
passing this to C# function
--> Here i dont know how to marshal a vector in C#
I would like to know which is the better way to transfer a Linked list
to C#, if there is any other approach please let me know...
Thanks and Regards,
Subodh
I want to use a C++ API in a static lib that returns a linked List in
C#
I am planning to P/Invoke to perform the Interop, I would like to know
which way will be better to interop a Linked list to C# in terms of
performance, I have came across following methods
I am creating a flat DLL to export the static lib functionality.
1. From the C++ DLL write the linked list structures in an xml file
and pass the path of the file to C# app which will
read data from this file
2. Use callback function
-pass a pointer to C# function(delegate) from C# to the exported C++
DLL function
-in the C++ DLL perform callback to this C# function with a pointer to
structure, for each structure in the linked list
-The C# callback function will then marshal the structure using
"PtrToStructure" and put this in required collection
----> With this approach i am worried about performancee if the linked
list contains thousands of nodes
3. Creating a Vector of structure from Linked list in C++ DLL and
passing this to C# function
--> Here i dont know how to marshal a vector in C#
I would like to know which is the better way to transfer a Linked list
to C#, if there is any other approach please let me know...
Thanks and Regards,
Subodh