On my Modeler application I want to code the feature of importing .NET types of any assembly to class development shape. To be successful, I need to use Reflection to enumerate types. So I begin to code that using C# as a stand alone assembly (dll):
Now, I have the data structure that contains all the assembly names for a dedicated assembly.
I will use my Modeler application to call this pseudo piece of code:
- Open a File dialog box to select an assembly
- Call the AssemblyExtractor assembly routines by passing the assembly name as a parameter
- Get a List<ExtractorData> that contains the data
- For each element, Add a development shape of class’s type and
- Calculate a position on the screen for each element data
Here the C++ code that contains C++/CLI calls. In the same C++ file, i can call CLR routines because my project is configured to accept the CLR support.
My Modeler application is built using UNICODE. Strings are wide char alias wchar_t *. Here is the source code in the C++ file:
You can see I call the Extractor class in the C++ code !!! I manage String^ and List<T> datatypes. To enable this, I have added a reference of the AssemblyExtractor assembly to the project.
Here is the result:
Only C++ allows to mix C++ and C++/CLI .NET code. It is amazing…